📄 form6.frm
字号:
Left = 840
TabIndex = 3
Top = 1200
Visible = 0 'False
Width = 4065
_ExtentX = 7170
_ExtentY = 4180
_Version = 393216
ForeColor = 16711680
BackColor = -2147483633
Appearance = 1
MonthBackColor = 13762302
StartOfWeek = 23789569
TitleBackColor = 13802436
TrailingForeColor= 13762302
CurrentDate = 38814
MaxDate = 47848
MinDate = 33970
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 4395
Left = 120
TabIndex = 1
Top = 210
Width = 14895
_ExtentX = 26273
_ExtentY = 7752
_Version = 393216
AllowUpdate = -1 'True
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
AllowRowSizing = 0 'False
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
End
Attribute VB_Name = "FrmDj2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private M_Client As Long
'===================xxxxxxxxxxxx
Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
cmdDel.Enabled = Not Adodc1.Recordset.EOF
End Sub
Private Sub Adodc1_RecordsetChangeComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
If Adodc1.Recordset.EOF = True Then
cmdDel.Move DataGrid1.Left + 30, DataGrid1.RowHeight + DataGrid1.Top
End If
cmdDel.Enabled = Not Adodc1.Recordset.EOF
End Sub
Private Sub cmdDel_Click()
Dim Clnt As Long '客户编号
Dim Dt As Date
Dim SQL As String 'SQL语句
Dt = Adodc1.Recordset.Fields("借款时间").Value
If MsgBox("你确定要删除" & txtXm.Caption & Dt & "的借款记录吗?", vbOKCancel + vbDefaultButton2 + vbQuestion, "删除借款") = vbCancel Then Exit Sub
'删除客户信息
Clnt = Adodc1.Recordset.Fields("客户编号").Value
'删除主客户表记录
'SQL = "DELETE FROM 客户表 Where 客户编号=" & Clnt
'ExecSQL SQL
'删除买会表记录
'SQL = "UPDATE 客户表 SET 编号=编号-1 WHERE 所在帐本=" & Zb & " AND 编号>" & Id
'ExecSQL SQL
Adodc1.Recordset.Delete
'SQL = "DELETE FROM 买会表 Where 客户编号=" & Clnt
'ExecSQL SQL
'自动排列编号
DataGrid1.Refresh
If DataGrid1.Row = -1 Then
cmdDel.Enabled = False
Else
cmdDel.Enabled = True
End If
End Sub
Private Sub Command1_Click()
Dim SQL As String
Dim Tmp As Integer
If (InStr(txtLXGH.Text, "'") > 0) Or (InStr(txtLXGH.Text, ";")) Then MsgBox "你输入利息归还时间含非法字符!", 16: Exit Sub
SQL = "SELECT Count(*) FROM 借款表 WHERE 借款时间=#" & DTP.Value & "# And 客户编号=" & M_Client
Tmp = GetValue(SQL)
If Tmp = 0 Then
Adodc1.Recordset.AddNew
Adodc1.Recordset!客户编号 = M_Client
Adodc1.Recordset!借款时间 = DTP.Value
Adodc1.Recordset!借款金额 = Val(txtJe)
Adodc1.Recordset!利息 = Val(txtLX)
Adodc1.Recordset!利息归还时间 = txtLXGH
Adodc1.Recordset!备注 = ""
Adodc1.Recordset.Update
Command1.Enabled = False
txtJe = 0
txtLX = 0
Else
MsgBox Format(DTP.Value, "YYYY年M月D日") & "的借款已经保存过!", vbOKOnly, "重复"
End If
If Text2.Text <> "" Then SaveSetting App.EXEName, "Settings", "UserName", Text2.Text
End Sub
Private Sub Command2_Click()
frmBZ.Show 1
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
If DataGrid1.Row >= 0 Then
cmdDel.Move DataGrid1.Left + 30, DataGrid1.RowTop(DataGrid1.Row) + DataGrid1.RowHeight
Else
cmdDel.Move DataGrid1.Left + 30, DataGrid1.RowHeight + DataGrid1.Top
End If
End Sub
Private Sub Form_Initialize()
InitCommonControls
End Sub
Private Sub Form_Resize()
On Error Resume Next
Frame1.Width = Me.ScaleWidth - Frame1.Left * 2
Frame1.Height = Me.ScaleHeight - Frame2.Height - Frame1.Top * 2
DataGrid1.Width = Frame1.Width - DataGrid1.Left * 2
DataGrid1.Height = Frame1.Height - DataGrid1.Top * 2
Frame2.Top = (Frame1.Height + Frame1.Top)
Frame2.Width = Frame1.Width
Picture2.Width = Frame2.Width - Picture2.Left * 2
Command1.Left = Picture2.ScaleWidth - 1200
Label9.Width = Picture2.ScaleWidth - 30
End Sub
Private Sub MV_DateClick(ByVal DateClicked As Date)
DataGrid1.Columns(DataGrid1.Columns.Count - 2).Value = True
DataGrid1.Text = Format(MV.Value, "YYYY年MM月DD日")
MV.Visible = False
End Sub
Private Sub DataGrid1_ButtonClick(ByVal ColIndex As Integer)
'自动定位日期控件3
Dim T As Single
Dim L As Single
If ColIndex = -1 Then Exit Sub
L = DataGrid1.Columns.Item(ColIndex).Left + DataGrid1.Left
T = DataGrid1.RowTop(DataGrid1.Row) + DataGrid1.Top + DataGrid1.RowHeight
If ColIndex = 5 Then
MV.Move L, T
MV.Visible = True
MV.SetFocus
On Error GoTo Dterr
'If Not (DataGrid1.Columns(1).Value Is Nothing) Then
MV.MinDate = DataGrid1.Columns(1).Value
'End If
Exit Sub
Dterr:
MV.MinDate = #1/1/1993#
ElseIf ColIndex = 1 Then
MV.Move L, T
MV.Visible = True
MV.MinDate = #1/1/1993#
MV.SetFocus
End If
If ColIndex = 7 Then
On Error Resume Next
txtBz.Move L, T
If Not IsNull(DataGrid1.Columns(7).Value) Then txtBz.Text = CStr(DataGrid1.Columns(7).Value)
txtBz.Visible = True
txtBz.SetFocus
'===================================================
'add to here
'===================================================
End If
End Sub
Private Sub DataGrid1_OnAddNew()
DataGrid1.Columns(0).Value = M_Client
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = mdCom.conStr
End Sub
Public Property Get Client() As Long
Client = M_Client
End Property
Public Property Let Client(ByVal vNewValue As Long)
M_Client = vNewValue
GetClientInfo
End Property
Private Sub GetClientInfo()
Dim ZBID As Long
If M_Client <> 0 Then
Dim SQL As String
SQL = "SELECT * FROM 借款表 Where 客户编号=" & M_Client
If Not (Adodc1.Recordset Is Nothing) Then
If Adodc1.Recordset.State <> 0 Then
If Not (Adodc1.Recordset.EOF And Adodc1.Recordset.BOF) Then _
Adodc1.Recordset.Update
Adodc1.Recordset.Close
Adodc1.Recordset.Open SQL
End If
Else
Adodc1.RecordSource = SQL
End If
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
DataGrid1.Columns(0).Visible = False
DataGrid1.Columns(1).Button = True
DataGrid1.Columns(5).Button = True
DataGrid1.Columns(7).Button = True
DataGrid1.Columns(DataGrid1.Columns.Count - 2).Visible = False
DataGrid1.Columns(1).Locked = True
DataGrid1.Columns(5).Locked = True
DataGrid1.Columns(7).Locked = True
Dim Dt As Date
Dim Rs As New ADODB.Recordset
ZBID = GetValue("SELECT 所在帐本 FROM 客户表 WHERE 客户编号=" & M_Client)
Set Rs = GetRecord("SELECT * From 客户表 Where 客户编号=" & M_Client)
txtBh = Rs!编号 & "号"
txtXm = Rs!客户名称
txtJKXM = Rs!客户名称
txtDh = IIf(IsNull(Rs!电话号码), "", Rs!电话号码)
txtSJ = IIf(IsNull(Rs!手机号码), "", Rs!手机号码)
txtHk.Caption = GetMoney(M_Client)
txtRhsj = VBA.Format(Rs!入会时间, "YYYY年M月D日")
txtBh = GetValue("SELECT 帐本 FROM 帐本表 WHERE 帐本编号=" & ZBID) & " " & txtBh
End If
Text2.Text = GetSetting(App.EXEName, "Settings", "UserName", "")
Me.SetFocus
End Sub
Private Sub MV_LostFocus()
MV.Visible = False
End Sub
Private Sub SetSaveCmd()
Command1.Enabled = False
If Val(txtJe) > 0 Then
If Val(txtLX) >= 0 Then
If Val(txtLXGH) >= 0 Then
Command1.Enabled = True
End If
End If
End If
End Sub
Private Sub txtBz_Change()
DataGrid1.Columns(7).Value = txtBz.Text
End Sub
Private Sub txtBz_LostFocus()
txtBz.Visible = False
End Sub
Private Sub txtJe_Change()
SetSaveCmd
End Sub
Private Sub txtLX_Change()
SetSaveCmd
End Sub
Private Sub txtLXGH_Change()
SetSaveCmd
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -