www.pudn.com > vb625557712344.rar > FrmReturnEdit.frm, change:2005-06-03,size:30261b
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form FrmReturnEdit
Caption = "汽车归还结算"
ClientHeight = 7470
ClientLeft = 60
ClientTop = 345
ClientWidth = 8640
LinkTopic = "Form1"
Picture = "FrmReturnEdit.frx":0000
ScaleHeight = 7470
ScaleWidth = 8640
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H80000013&
BorderStyle = 0 'None
Height = 375
Left = 360
Locked = -1 'True
MultiLine = -1 'True
TabIndex = 57
Text = "FrmReturnEdit.frx":E2C4
Top = 6960
Width = 6975
End
Begin VB.Frame Frame3
Height = 735
Left = 120
TabIndex = 48
Top = 5640
Width = 8415
Begin VB.TextBox txtRate
Enabled = 0 'False
Height = 300
Left = 975
TabIndex = 55
Text = "1"
Top = 240
Width = 800
End
Begin VB.TextBox txtRealPay
Height = 300
Left = 5175
TabIndex = 53
Text = "0"
Top = 240
Width = 800
End
Begin VB.TextBox txtTotal
Enabled = 0 'False
Height = 300
Left = 3135
TabIndex = 50
Text = "0"
Top = 240
Width = 800
End
Begin VB.TextBox txtUserName
Height = 300
Left = 7440
TabIndex = 49
Top = 240
Width = 800
End
Begin VB.Label Label18
AutoSize = -1 'True
Caption = "享受折扣"
Height = 180
Left = 120
TabIndex = 56
Top = 300
Width = 720
End
Begin VB.Label Label17
AutoSize = -1 'True
Caption = "实付金额"
Height = 180
Left = 4320
TabIndex = 54
Top = 300
Width = 720
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "费用总额"
Height = 180
Left = 2280
TabIndex = 52
Top = 300
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "经办人"
Height = 180
Left = 6720
TabIndex = 51
Top = 300
Width = 540
End
End
Begin VB.CommandButton Cmd_SchContract
Caption = "查找"
Height = 375
Left = 4200
TabIndex = 22
Top = 120
Width = 855
End
Begin VB.TextBox txtContractNo
Height = 330
Left = 1080
TabIndex = 11
Top = 100
Width = 2895
End
Begin VB.CommandButton Cmd_Cancel
Caption = "取 消"
Height = 375
Left = 4920
MouseIcon = "FrmReturnEdit.frx":E30F
TabIndex = 9
Top = 6480
Width = 1095
End
Begin VB.CommandButton Cmd_OK
Caption = "结 算"
Height = 375
Left = 2520
MouseIcon = "FrmReturnEdit.frx":E619
TabIndex = 8
Top = 6480
Width = 1095
End
Begin VB.Frame Frame4
Caption = "租赁信息"
Height = 2655
Left = 120
TabIndex = 2
Top = 2880
Width = 8415
Begin VB.TextBox txtRealRTime
Height = 300
Left = 3735
TabIndex = 46
Top = 1428
Width = 1815
End
Begin VB.TextBox txtOKMCost
Enabled = 0 'False
Height = 300
Left = 7320
TabIndex = 44
Text = "0"
Top = 1824
Width = 800
End
Begin VB.TextBox txtOTCost
Enabled = 0 'False
Height = 300
Left = 3735
TabIndex = 42
Text = "0"
Top = 1824
Width = 800
End
Begin VB.TextBox txtReturnKM
Height = 300
Left = 7320
TabIndex = 40
Text = "0"
Top = 1428
Width = 800
End
Begin VB.TextBox txtOutKM
Enabled = 0 'False
Height = 300
Left = 7320
TabIndex = 38
Text = "0"
Top = 1032
Width = 800
End
Begin VB.TextBox txtOtherCost
Height = 300
Left = 7320
TabIndex = 36
Text = "0"
Top = 2220
Width = 800
End
Begin VB.TextBox txtOKMPrice
Enabled = 0 'False
Height = 300
Left = 7320
TabIndex = 29
Text = "0"
Top = 636
Width = 800
End
Begin VB.TextBox txtOTPrice
Enabled = 0 'False
Height = 300
Left = 3735
TabIndex = 28
Text = "0"
Top = 240
Width = 800
End
Begin VB.TextBox txtDayKM
Enabled = 0 'False
Height = 300
Left = 7320
TabIndex = 27
Text = "0"
Top = 240
Width = 800
End
Begin VB.TextBox txtDayPrice
Enabled = 0 'False
Height = 300
Left = 960
TabIndex = 26
Text = "0"
Top = 1032
Width = 800
End
Begin VB.TextBox txtDeposit
Enabled = 0 'False
Height = 300
Left = 960
TabIndex = 25
Text = "0"
Top = 240
Width = 800
End
Begin VB.TextBox txtWeekEndPrice
Enabled = 0 'False
Height = 300
Left = 960
TabIndex = 24
Text = "0"
Top = 1428
Width = 800
End
Begin VB.TextBox txtLeaseMode
Enabled = 0 'False
Height = 300
Left = 960
TabIndex = 23
Top = 636
Width = 800
End
Begin VB.TextBox txtWeekEndCount
Enabled = 0 'False
Height = 300
Left = 960
TabIndex = 18
Text = "0"
Top = 2220
Width = 800
End
Begin VB.TextBox txtWorkDays
Enabled = 0 'False
Height = 300
Left = 960
TabIndex = 15
Text = "0"
Top = 1824
Width = 800
End
Begin VB.TextBox txtCost
Enabled = 0 'False
Height = 300
Left = 3735
TabIndex = 13
Text = "0"
Top = 2220
Width = 800
End
Begin VB.TextBox txtReturnTime
Enabled = 0 'False
Height = 300
Left = 3735
TabIndex = 7
Top = 1032
Width = 1815
End
Begin VB.TextBox txtLeaseTime
Enabled = 0 'False
Height = 300
Left = 3735
TabIndex = 6
Top = 636
Width = 1815
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "实际还车时间"
Height = 180
Left = 2520
TabIndex = 47
Top = 1488
Width = 1080
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "超公里费用"
Height = 180
Left = 6225
TabIndex = 45
Top = 1884
Width = 900
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "超时费用"
Height = 180
Left = 2880
TabIndex = 43
Top = 1884
Width = 720
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "回车公里数"
DataSource = "Adodc1"
Height = 180
Left = 6225
TabIndex = 41
Top = 1488
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "出车公里数"
Height = 180
Left = 6225
TabIndex = 39
Top = 1092
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "其他费用"
Height = 180
Left = 6405
TabIndex = 37
Top = 2280
Width = 720
End
Begin VB.Label Label26
AutoSize = -1 'True
Caption = "超公里加"
Height = 180
Left = 6405
TabIndex = 35
Top = 696
Width = 720
End
Begin VB.Label Label24
AutoSize = -1 'True
Caption = "超时加"
Height = 180
Left = 3060
TabIndex = 34
Top = 300
Width = 540
End
Begin VB.Label Label22
AutoSize = -1 'True
Caption = "日限公里"
Height = 180
Left = 6405
TabIndex = 33
Top = 300
Width = 720
End
Begin VB.Label Label16
AutoSize = -1 'True
Caption = "租金"
Height = 180
Left = 480
TabIndex = 32
Top = 1092
Width = 360
End
Begin VB.Label Label15
AutoSize = -1 'True
Caption = "押金"
Height = 180
Left = 480
TabIndex = 31
Top = 300
Width = 360
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "周末租金"
Height = 180
Left = 120
TabIndex = 30
Top = 1488
Width = 720
End
Begin VB.Label Label20
AutoSize = -1 'True
Caption = "个"
Height = 180
Left = 1800
TabIndex = 19
Top = 2280
Width = 180
End
Begin VB.Label Label19
AutoSize = -1 'True
Caption = "周末数"
Height = 180
Left = 300
TabIndex = 17
Top = 2280
Width = 540
End
Begin VB.Label Label14
AutoSize = -1 'True
Caption = "个"
Height = 180
Left = 1800
TabIndex = 16
Top = 1884
Width = 180
End
Begin VB.Label Label13
AutoSize = -1 'True
Caption = "工作日"
Height = 180
Left = 300
TabIndex = 14
Top = 1884
Width = 540
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "租车费用"
Height = 180
Left = 2880
TabIndex = 12
Top = 2280
Width = 720
End
Begin VB.Label Label33
AutoSize = -1 'True
Caption = "还车时间"
Height = 180
Left = 2880
TabIndex = 5
Top = 1092
Width = 720
End
Begin VB.Label Label31
AutoSize = -1 'True
Caption = "租车时间"
Height = 180
Left = 2880
TabIndex = 4
Top = 696
Width = 720
End
Begin VB.Label Label12
AutoSize = -1 'True
Caption = "租赁模式"
Height = 180
Left = 120
TabIndex = 3
Top = 696
Width = 720
End
End
Begin VB.Frame Frame2
Caption = "客户信息"
Height = 1095
Left = 120
TabIndex = 1
Top = 1680
Width = 8415
Begin MSAdodcLib.Adodc AdoCustomer
Height = 375
Left = 6360
Top = 120
Visible = 0 'False
Width = 2055
_ExtentX = 3625
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "AdoCustomer"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid2
Height = 735
Left = 120
TabIndex = 21
Top = 240
Width = 8175
_ExtentX = 14420
_ExtentY = 1296
_Version = 393216
AllowUpdate = 0 'False
Enabled = 0 'False
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
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
Begin VB.Frame Frame1
Caption = "汽车信息"
Height = 1095
Left = 120
TabIndex = 0
Top = 480
Width = 8415
Begin MSAdodcLib.Adodc AdoCar
Height = 375
Left = 6480
Top = 120
Visible = 0 'False
Width = 1935
_ExtentX = 3413
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "AdoCar"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 735
Left = 120
TabIndex = 20
Top = 240
Width = 8175
_ExtentX = 14420
_ExtentY = 1296
_Version = 393216
AllowUpdate = 0 'False
Enabled = 0 'False
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
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "合同编号"
Height = 180
Left = 240
TabIndex = 10
Top = 150
Width = 720
End
End
Attribute VB_Name = "FrmReturnEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public sContractNo As String
Public sCarNo As String
Public sCustId As String
Dim nDiff As Integer
Dim nKMDiff As Integer
Dim lCost As Long
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
If Len(Trim(txtContractNo)) = 0 Then
MsgBox ("请输入合同编号")
txtContractNo.SetFocus
Exit Sub
End If
If Len(Trim(txtRealRTime)) = 0 Then
MsgBox ("请输入实际归还时间")
txtReturnTime.SetFocus
Exit Sub
End If
If Len(Trim(txtUserName)) = 0 Then
MsgBox ("请输经办人姓名")
txtUserName.SetFocus
Exit Sub
End If
If Len(Trim(txtReturnKM)) = 0 Or Val(txtReturnKM) = 0 Then
MsgBox ("请输入归还时公里数")
txtReturnKM.SetFocus
Exit Sub
End If
With MyLease
.ContractNo = MakeStr(txtContractNo)
.ReturnKM = Val(txtReturnKM)
.RealRTime = MakeStr(txtRealRTime)
.OtherCost = Val(txtOtherCost)
.Payment = Val(txtRealPay)
.Total = Val(txtTotal)
.UserName = MakeStr(txtUserName)
.Status = "归还"
.UpdateSettleAccount (Trim(txtContractNo))
End With
Unload Me
End Sub
Private Sub Cmd_SchContract_Click()
If Len(Trim(txtContractNo)) = 0 Then
MsgBox ("请输入合同编号")
txtContractNo.SetFocus
Exit Sub
End If
If MyLease.GetInfo(Trim(txtContractNo)) = True Then
If InStr(Trim(MyLease.Status), "审核") = 0 Then
MsgBox ("合同必须审核了才可以办理归还结算手续")
Exit Sub
End If
sCarNo = Trim(MyLease.CarNo)
sCustId = Trim(MyLease.CustId)
txtDeposit = MyLease.Deposit
txtDayPrice = MyLease.Price1
txtWeekEndPrice = MyLease.Price2
txtOKMPrice = MyLease.OPrice1
txtOTPrice = MyLease.OPrice2
txtDayKM = MyLease.DayKM
txtLeaseMode = Trim(MyLease.LeaseMode)
txtLeaseTime = Trim(MyLease.LeaseTime)
txtReturnTime = Trim(MyLease.ReturnTime)
txtRealRTime = Trim(Str(Now))
nDiff = DateDiff("h", CDate(Trim(txtReturnTime)), CDate(Trim(txtRealRTime)))
If nDiff = 0 Then
txtOTCost = 0
Else
txtOTCost = Val(txtOTPrice) * nDiff
End If
If Trim(MyLease.LeaseMode) = "日" Then
txtWorkDays = MyLease.WorkDays
txtWeekEndCount = MyLease.WeekEndCount
Label13.Caption = "工作日"
txtCost = MyLease.WorkDays * MyLease.Price1 + MyLease.WorkDays * MyLease.Price2
ElseIf Trim(MyLease.LeaseMode) = "周" Then
txtWorkDays = MyLease.WorkDays
txtWeekEndCount = 0
Label13.Caption = "周数"
Label19.Caption = "超时数"
txtCost = MyLease.WorkDays * MyLease.Price1
ElseIf Trim(MyLease.LeaseMode) = "月" Then
txtWorkDays = MyLease.WorkDays
txtWeekEndCount = 0
Label13.Caption = "月份数"
Label19.Caption = "超时数"
txtCost = MyLease.WorkDays * MyLease.Price1
End If
txtOutKM = MyLease.OutKM
txtTotal = (Val(txtCost) + Val(txtOTCost) + Val(txtOKMCost)) * Val(txtRate) + Val(txtOtherCost)
txtRealPay = Val(txtTotal) - Val(txtDeposit)
txtRate = MyLease.Rate * 10
End If
CarRefresh
CustomerRefresh
End Sub
Private Sub Form_Load()
sCarNo = ""
sCustId = ""
CarRefresh
CustomerRefresh
End Sub
Public Sub CarRefresh()
AdoCar.ConnectionString = Conn
AdoCar.RecordSource = "SELECT c.CarNo AS 车牌号,c.CarName AS 车辆名称,t.TypeName AS 车辆类型," _
+ "c.Color AS 颜色,c.OilNo AS 汽油编号,c.BuyDate AS 购买日期 " _
+ " FROM Cars c,Types t" _
+ " WHERE c.TypeId=t.Id AND c.CarNO='" + Trim(sCarNo) + "'"
AdoCar.Refresh
Set DataGrid1.DataSource = AdoCar
DataGrid1.Columns(0).Width = 1400
DataGrid1.Columns(1).Width = 1400
DataGrid1.Columns(2).Width = 1200
DataGrid1.Columns(3).Width = 1000
DataGrid1.Columns(4).Width = 1000
DataGrid1.Columns(5).Width = 1600
End Sub
Public Sub CustomerRefresh()
AdoCustomer.ConnectionString = Conn
AdoCustomer.RecordSource = "SELECT Id AS 客户号,Name AS 姓名,Sex AS 性别,Age AS 年龄," _
+ "Telephone AS 电话,LicenseNo AS 驾驶证号,Certificate AS 抵押证件 " _
+ " FROM Customer WHERE Id='" + Trim(sCustId) + "'"
AdoCustomer.Refresh
Set DataGrid2.DataSource = AdoCustomer
DataGrid2.Columns(0).Width = 1000
DataGrid2.Columns(1).Width = 1000
DataGrid2.Columns(2).Width = 800
DataGrid2.Columns(3).Width = 800
DataGrid2.Columns(4).Width = 1600
DataGrid2.Columns(5).Width = 1600
DataGrid2.Columns(6).Width = 1000
End Sub
Private Sub txtOtherCost_Change()
txtTotal = (Val(txtCost) + Val(txtOTCost) + Val(txtOKMCost)) * Val(txtRate) / 10 + Val(txtOtherCost)
txtRealPay = Val(txtTotal) - Val(txtDeposit)
End Sub
Private Sub txtRealRTime_LostFocus()
nDiff = DateDiff("h", CDate(Trim(txtReturnTime)), CDate(Trim(txtRealRTime)))
If nDiff = 0 Then
txtOTCost = 0
txtWeekEndCount = 0
Else
txtOTCost = Val(txtOTPrice) * nDiff
txtWeekEndCount = nDiff
End If
txtTotal = (Val(txtCost) + Val(txtOTCost) + Val(txtOKMCost)) * Val(txtRate) / 10 + Val(txtOtherCost)
txtRealPay = Val(txtTotal) - Val(txtDeposit)
End Sub
Private Sub txtReturnKM_Change()
Dim nD As Integer
Dim nL As Long
Dim nR As Long
nD = DateDiff("d", CDate(Trim(txtLeaseTime)), CDate(Trim(txtRealRTime)))
nL = Val(txtDayKM) * nD
nR = Val(txtReturnKM) - Val(txtOutKM)
If nR > nL Then
txtOKMCost = Val(txtOKMPrice) * (nR - nL)
Else
txtOKMCost = 0
End If
txtTotal = (Val(txtCost) + Val(txtOTCost) + Val(txtOKMCost)) * Val(txtRate) / 10 + Val(txtOtherCost)
txtRealPay = Val(txtTotal) - Val(txtDeposit)
End Sub