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

📄 frmpayzujin.frm

📁 本课题为实践课题
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Width           =   1215
         End
         Begin VB.Label Label2 
            Caption         =   "月"
            Height          =   255
            Index           =   6
            Left            =   7440
            TabIndex        =   42
            Top             =   960
            Width           =   255
         End
         Begin VB.Label Label1 
            Caption         =   "备   注"
            Height          =   255
            Index           =   11
            Left            =   360
            TabIndex        =   41
            Top             =   2880
            Width           =   735
         End
         Begin VB.Label Label1 
            Caption         =   "合同编号"
            Height          =   255
            Index           =   7
            Left            =   360
            TabIndex        =   40
            Top             =   360
            Width           =   735
         End
         Begin VB.Label Label1 
            Caption         =   "客户姓名"
            Height          =   255
            Index           =   8
            Left            =   2760
            TabIndex        =   39
            Top             =   360
            Width           =   735
         End
         Begin VB.Label Label1 
            Caption         =   "房屋编号"
            Height          =   255
            Index           =   9
            Left            =   5280
            TabIndex        =   38
            Top             =   360
            Width           =   735
         End
         Begin VB.Label Label1 
            Caption         =   "起租日期"
            Height          =   255
            Index           =   10
            Left            =   360
            TabIndex        =   37
            Top             =   960
            Width           =   735
         End
         Begin VB.Label Label1 
            Caption         =   "止租日期"
            Height          =   255
            Index           =   12
            Left            =   2760
            TabIndex        =   36
            Top             =   960
            Width           =   735
         End
         Begin VB.Label Label1 
            Caption         =   "租   期"
            Height          =   255
            Index           =   13
            Left            =   5280
            TabIndex        =   35
            Top             =   960
            Width           =   735
         End
         Begin VB.Label Label1 
            Caption         =   "月租金"
            Height          =   255
            Index           =   14
            Left            =   360
            TabIndex        =   34
            Top             =   1560
            Width           =   735
         End
         Begin VB.Label Label1 
            Caption         =   "总租金"
            Height          =   255
            Index           =   15
            Left            =   2880
            TabIndex        =   33
            Top             =   1560
            Width           =   615
         End
         Begin VB.Label Label1 
            Caption         =   "押金"
            Height          =   255
            Index           =   16
            Left            =   5400
            TabIndex        =   32
            Top             =   1560
            Width           =   495
         End
         Begin VB.Label Label2 
            Caption         =   "元"
            Height          =   255
            Index           =   1
            Left            =   2520
            TabIndex        =   31
            Top             =   1560
            Width           =   255
         End
         Begin VB.Label Label2 
            Caption         =   "元"
            Height          =   255
            Index           =   2
            Left            =   4920
            TabIndex        =   30
            Top             =   1560
            Width           =   255
         End
         Begin VB.Label Label2 
            Caption         =   "元"
            Height          =   255
            Index           =   3
            Left            =   7440
            TabIndex        =   29
            Top             =   1560
            Width           =   255
         End
         Begin VB.Label Label1 
            Caption         =   "业务员"
            Height          =   255
            Index           =   17
            Left            =   360
            TabIndex        =   28
            Top             =   2160
            Width           =   735
         End
         Begin VB.Label Label1 
            Caption         =   "签订日期"
            Height          =   255
            Index           =   18
            Left            =   2760
            TabIndex        =   27
            Top             =   2160
            Width           =   735
         End
      End
   End
End
Attribute VB_Name = "frmPayZuJin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim sqlpay As String
Dim sqlclient As String
Dim sqlch As String
Dim rs_pay As New ADODB.Recordset
Dim rs_client As New ADODB.Recordset
Dim rs_ch As New ADODB.Recordset

Private Sub cmdAdd_Click()
   '先检测数据完整性
   If Text1(0).Text = "" Then
      MsgBox "收费编号不可为空!", vbOKOnly + vbInformation, "注意"
      Text1(0).SetFocus
      Exit Sub
   End If
   If Text1(1).Text = "" Or IsNumeric(Text1(1).Text) = False Then
      MsgBox "租金年份应为数字!", vbOKOnly + vbInformation, "注意"
      Text1(1).SetFocus
      Exit Sub
   End If
   If Text1(2).Text = "" Or IsNumeric(Text1(2).Text) = False Or Val(Text1(2).Text) < 1 Or Val(Text1(2).Text) > 12 Then
      MsgBox "租金月份应为1-12的数字!", vbOKOnly + vbInformation, "注意"
      Text1(2).SetFocus
      Exit Sub
   End If
   If Text1(3).Text = "" Or IsNumeric(Text1(3).Text) = False Then
      MsgBox "应交租金应为数字!", vbOKOnly + vbInformation, "注意"
      Text1(3).SetFocus
      Exit Sub
   End If
   If Text1(4).Text = "" Or IsNumeric(Text1(4).Text) = False Then
      MsgBox "已交租金应为数字!", vbOKOnly + vbInformation, "注意"
      Text1(4).SetFocus
      Exit Sub
   End If
   If Text1(6).Text = "" Then
      MsgBox "客户姓名不可为空!", vbOKOnly + vbInformation, "注意"
      Text1(6).SetFocus
      Exit Sub
   End If
   If Text1(7).Text = "" Or IsDate(Text1(7).Text) = False Then
      MsgBox "收费日期应为这样的日期格式:2003-8-3!", vbOKOnly + vbInformation, "注意"
      Text1(7).SetFocus
      Exit Sub
   End If
   
   
   '检测该收费编号是否已存在
   sqlch = "select * from ZuJin where 收费编号 = '" & Text1(0).Text & "'"
   rs_ch.Open sqlch, conn, adOpenStatic, adLockOptimistic
   If rs_ch.EOF = False Then
      MsgBox "该收费编号已经存在,请重新输入一个!", vbOKOnly + vbInformation, "注意"
      Text1(0).SetFocus
      rs_ch.Close
      Exit Sub
   End If
   rs_ch.Close
   
   '还需要检测客户姓名是否存在
   sqlclient = "select * from Contract where 客户姓名 = '" & Text1(6).Text & "'"
   rs_client.Open sqlclient, conn, adOpenStatic, adLockOptimistic
   If rs_client.EOF = True Then
      MsgBox "该客户姓名在合同表中不存在!", vbOKOnly + vbInformation, "注意"
      rs_client.Close
      Text1(6).SetFocus
      Exit Sub
   End If
   rs_client.Close
   '计算欠费金额
   Text1(5).Text = Val(Text1(3).Text) - Val(Text1(4).Text)
   '加入租金收费表
   sqlpay = "select * from ZuJin "
   rs_pay.Open sqlpay, conn, adOpenStatic, adLockOptimistic
   rs_pay.AddNew
   For i = 0 To 8
      rs_pay.Fields(i) = Text1(i).Text
   Next i
   rs_pay.Update
   rs_pay.Close
   MsgBox "收取租金成功!", vbOKOnly + vbInformation, "注意"
   
   '添加完后,需要设置收取租金按钮不可用
   cmdAdd.Enabled = False
   
End Sub

Private Sub cmdClose_Click()
   Unload Me
End Sub

Private Sub cmdReset_Click()
   '清空所有text
   For i = 0 To 8
      Text1(i).Text = ""
   Next i
   '设定收费日期为当前日期
   Text1(7).Text = Date
   '设置收取租金按钮为可用
   cmdAdd.Enabled = True
   
End Sub

Private Sub Form_Load()
   Dim X0 As Long
   Dim Y0 As Long
   '让窗体居中
   X0 = Screen.Width
   Y0 = Screen.Height
   X0 = (X0 - Me.Width) / 2
   Y0 = (Y0 - Me.Height) / 2
   Me.Move X0, Y0
   '欠费金额text设为不可写,自动计算而得
   Text1(5).Enabled = False
   '设置所有合同资料选项卡的text为不可写
   For i = 9 To 20
      Text1(i).Enabled = False
   Next i
   '判断是从frmSignContract调用的还是菜单直接调用的本窗体
   If ZuJinfromContract = False Then
   '菜单直接调用的
      '如果要显示的是租金收取选项卡
      If SSTab1.Tab = 0 Then
         '清空所有text
         For i = 0 To 8
            Text1(i).Text = ""
         Next i
         '设定收费日期为当前日期
         Text1(7).Text = Date
      '如果要显示的是合同资料选项卡
      ElseIf SSTab1.Tab = 1 Then
         '开始时,由于租金收取信息没有显示,因此相应的合同资料也都显示为空
         For i = 9 To 20
             Text1(i).Text = ""
         Next i
         cmdAdd.Enabled = False
         cmdReset.Enabled = False
      End If
   ElseIf ZuJinfromContract = True Then
   '从frmSignContract窗体调用的
      If SSTab1.Tab = 0 Then
         '需要把合同表中的客户姓名和月租金自动填入
         Text1(3).Text = frmSignContract.Text1(6).Text
         Text1(6).Text = frmSignContract.Text1(1).Text
         Text1(7).Text = Date
      ElseIf SSTab1.Tab = 1 Then
         For i = 0 To 11
            Text1(i + 9).Text = frmSignContract.Text1(i).Text
         Next i
         cmdAdd.Enabled = False
         cmdReset.Enabled = False
      End If
  End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
   '设置ZuJinfromContract=false
   ZuJinfromContract = False
End Sub

Private Sub SSTab1_Click(PreviousTab As Integer)
   
   If SSTab1.Tab = 0 Then
      '不需要改变数据,只需要相应修改按钮是否可用
      cmdReset.Enabled = True
      cmdAdd.Enabled = True
      '设定收费日期为当前日期
      Text1(7).Text = Date
   '合同选项卡
   Else
      cmdReset.Enabled = False
      cmdAdd.Enabled = False
      
      '如果租金收取选项卡中客户姓名为空
      If Text1(6).Text = "" Then
         For i = 9 To 20
            Text1(i).Text = ""
         Next i
      '如果租金收取选项卡中客户姓名不为空,则打开相应记录
      Else
         sqlclient = "select * from Contract where 客户姓名 = '" & Text1(6).Text & "'"
         rs_client.Open sqlclient, conn, adOpenStatic, adLockOptimistic
         If rs_client.EOF = True Then
            MsgBox "相应客户姓名的合同记录不存在!", vbOKOnly + vbInformation, "注意"
            rs_client.Close
            For i = 9 To 20
               Text1(i).Text = ""
            Next i
            Exit Sub
         Else
            For i = 9 To 20
               Text1(i).Text = rs_client.Fields(i - 9)
            Next i
            rs_client.Close
         End If
      End If
   End If
         
End Sub



⌨️ 快捷键说明

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