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

📄 frmsm.frm

📁 以前写的一个销售的管理系统,是牙刷销存管理系统,有销售,进货等功能,刚学VB时写的
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Caption         =   "下欠货款:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   375
         Left            =   3240
         TabIndex        =   24
         Top             =   3480
         Width           =   1335
      End
      Begin VB.Label Label8 
         Caption         =   "日汇款:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   3480
         TabIndex        =   23
         Top             =   2880
         Width           =   855
      End
      Begin VB.Label Label7 
         Caption         =   "月"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   2640
         TabIndex        =   22
         Top             =   2880
         Width           =   255
      End
      Begin VB.Label Label6 
         Caption         =   "日汇款:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   3480
         TabIndex        =   19
         Top             =   2280
         Width           =   855
      End
      Begin VB.Label Label1 
         Caption         =   "月"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   2640
         TabIndex        =   18
         Top             =   2280
         Width           =   255
      End
      Begin VB.Label Label5 
         Caption         =   "日汇款:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   3480
         TabIndex        =   15
         Top             =   1680
         Width           =   855
      End
      Begin VB.Label Label4 
         Caption         =   "月"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   2640
         TabIndex        =   14
         Top             =   1680
         Width           =   255
      End
      Begin VB.Label Label3 
         Caption         =   "上次欠款:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   375
         Left            =   3240
         TabIndex        =   11
         Top             =   1080
         Width           =   1335
      End
      Begin VB.Label Label2 
         Caption         =   "本次金额:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   375
         Left            =   3240
         TabIndex        =   10
         Top             =   480
         Width           =   1455
      End
   End
End
Attribute VB_Name = "frmsm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
  On Error GoTo a
  DefaultType = dbUseODBC
  Dim db As Database
  Dim wk As Workspace
  Set wk = DBEngine.Workspaces(0)
  Dim rs1 As Recordset
  Dim rs2 As Recordset
  Set db = OpenDatabase("xsys", dbDriverNoPrompt, False, "odbc;database=glxt;uid=;pwd=;dsn=xsys")
  wk.BeginTrans
  Set rs1 = db.OpenRecordset("sm", dbOpenDynaset, dbwrite, dbOptimistic)
  rs1.AddNew
  rs1.Fields("发货单编号") = Trim(frmout.txtfh.Text)
  rs1.Fields("本次金额") = CCur(Text1.Text)
  rs1.Fields("上次欠款") = CCur(Text2.Text)
  rs1.Fields("日期1") = Text8.Text & Label11 & commonth1.Text & Label4 & comday1.Text & Label5
  rs1.Fields("汇款1") = CCur(Text3.Text)
  rs1.Fields("日期2") = Text9.Text & Label12 & commonth2.Text & Label1 & comday2.Text & Label6
  rs1.Fields("汇款2") = CCur(Text4.Text)
  rs1.Fields("日期3") = Text10.Text & Label13 & commonth3.Text & Label7 & comday3.Text & Label8
  rs1.Fields("汇款3") = CCur(Text5.Text)
  rs1.Fields("下欠货款") = CCur(Text6.Text)
  rs1.Fields("其他说明") = Text7.Text
  rs1.Update
  wk.CommitTrans
  rs1.Close
  db.Close
  Unload Me
a:
  If Err.Number = 13 Then
     MsgBox "款额不能是字符型!"
     Text1.SetFocus
  End If
  
End Sub

Private Sub Command2_Click()
  On Error GoTo a
  DefaultType = dbUseODBC
  Dim db As Database
  Dim wk As Workspace
  Set wk = DBEngine.Workspaces(0)
  Dim rs1 As Recordset
  Dim rs2 As Recordset
  Set db = OpenDatabase("xsys", dbDriverNoPrompt, False, "odbc;database=glxt;uid=;pwd=;dsn=xsys")
  wk.BeginTrans
  Set rs1 = db.OpenRecordset("sm", dbOpenDynaset, dbwrite, dbOptimistic)
  rs1.AddNew
  rs1.Fields("发货单编号") = Trim(frmout.txtfh.Text)
  rs1.Fields("本次金额") = CCur(Text1.Text)
  rs1.Fields("上次欠款") = CCur(Text2.Text)
  rs1.Fields("日期1") = Text8.Text & Label11 & commonth1.Text & Label4 & comday1.Text & Label5
  rs1.Fields("汇款1") = CCur(Text3.Text)
  rs1.Fields("日期2") = Text9.Text & Label12 & commonth2.Text & Label1 & comday2.Text & Label6
  rs1.Fields("汇款2") = CCur(Text4.Text)
  rs1.Fields("日期3") = Text10.Text & Label13 & commonth3.Text & Label7 & comday3.Text & Label8
  rs1.Fields("汇款3") = CCur(Text5.Text)
  rs1.Fields("下欠货款") = CCur(Text6.Text)
  rs1.Fields("其他说明") = Text7.Text
  rs1.Update
  wk.CommitTrans
  rs1.Close
  db.Close
  Unload Me
a:
  If Err.Number = 13 Then
     MsgBox "款额不能是字符型!"
     Text1.SetFocus
  End If
  
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
 Dim nexttabindex As Integer, i As Integer
       If KeyAscii = 13 Then
          If Screen.ActiveControl.TabIndex = Count - 1 Then
             nexttabindex = 0
          Else
             nexttabindex = Screen.ActiveControl.TabIndex + 1
          End If
          For i = 0 To Count - 1
              If Me.Controls(i).TabIndex = nexttabindex Then
                 Me.Controls(i).SetFocus
                 Exit For
              End If
          Next i
          KeyAscii = 0
        End If
End Sub

Private Sub Form_Load()
  DefaultType = dbUseODBC
  Dim db As Database
  Dim wk As Workspace
  Set wk = DBEngine.Workspaces(0)
  Dim rs1 As Recordset
  Dim rs2 As Recordset
  Dim zje As Currency
  zje = 0
  Set db = OpenDatabase("xsys", dbDriverNoPrompt, False, "odbc;database=glxt;uid=;pwd=;dsn=xsys")
  wk.BeginTrans
  Set rs1 = db.OpenRecordset("sm", dbOpenDynaset, dbwrite, dbOptimistic)
  rs1.MoveFirst
  Do While rs1.EOF <> True
     If rs1.Fields("发货单编号") = frmout.txtfh.Text Then
        rs1.Delete
        Exit Do
     End If
     rs1.MoveNext
     If rs1.EOF = True Then
        Exit Do
     End If
  Loop
  rs1.Close
  
  Set rs2 = db.OpenRecordset("temp", dbOpenDynaset, dbwrite, dbOptimistic)
  rs2.MoveFirst
  Do While rs2.EOF <> True
     zje = zje + rs2.Fields("总金额")
     rs2.MoveNext
     If rs2.EOF = True Then
        Exit Do
     End If
  Loop
  
  Text1.Text = Format$(CStr(zje), "0.00")
  Text2.Text = 0
  Text3.Text = 0
  Text4.Text = 0
  Text5.Text = 0
  Text6.Text = 0
  Text8.Text = CStr(Year(Now))
  Text9.Text = CStr(Year(Now))
  Text10.Text = CStr(Year(Now))
  commonth1.Text = CStr(Month(Now))
  comday1.Text = CStr(Day(Now))
  commonth2.Text = CStr(Month(Now))
  comday2.Text = CStr(Day(Now))
  commonth3.Text = CStr(Month(Now))
  comday3.Text = CStr(Day(Now))
  rs2.Close
  wk.CommitTrans
  db.Close
End Sub
Private Sub Text6_GotFocus()
  On Error GoTo a
  Text6.Text = CCur(Text1.Text) + CCur(Text2.Text) - CCur(Text3.Text) - CCur(Text4.Text) - CCur(Text5.Text)
a:
  If Err.Number = 13 Then
     MsgBox "款额不能是字符型!"
     Text1.SetFocus
  End If
End Sub

⌨️ 快捷键说明

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