📄 frmleaseedit.frm
字号:
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "AdoPrice"
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
End
Begin VB.Frame Frame1
Caption = "汽车信息"
Height = 1335
Left = 120
TabIndex = 0
Top = 480
Width = 8415
Begin MSAdodcLib.Adodc AdoCar
Height = 375
Left = 5040
Top = 240
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 = 495
Left = 120
TabIndex = 30
Top = 720
Width = 8175
_ExtentX = 14420
_ExtentY = 873
_Version = 393216
AllowUpdate = 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
Begin VB.CommandButton Cmd_SearchCar
Caption = "查找"
Height = 375
Left = 2160
TabIndex = 3
Top = 263
Width = 735
End
Begin VB.TextBox txtCarNo
Height = 300
Left = 960
TabIndex = 1
Top = 300
Width = 1095
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "车牌号码"
Height = 180
Left = 120
TabIndex = 2
Top = 360
Width = 720
End
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "合同编号"
Height = 180
Left = 240
TabIndex = 19
Top = 150
Width = 720
End
End
Attribute VB_Name = "FrmLeaseEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public ContractNo As String
Public sCarNo As String
Public sCustId As String
Public sLTime As String
Dim lCost As Long
Dim nCnt As Integer
Dim nECnt As Integer
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(txtUserName)) = 0 Then
MsgBox ("请输入经办人")
txtUserName.SetFocus
Exit Sub
End If
If Len(Trim(txtCarNo)) = 0 Then
MsgBox ("请输入车牌号")
txtCarNo.SetFocus
Exit Sub
End If
If Len(Trim(txtCustId)) = 0 Then
MsgBox ("请输入客户号")
txtCustId.SetFocus
Exit Sub
End If
If Len(Trim(cob_Mode.Text)) = 0 Then
MsgBox ("请选择租赁模式")
cob_Mode.SetFocus
Exit Sub
End If
If Len(Trim(txtLeaseTime)) = 0 Then
MsgBox ("请输入租赁时间")
txtLeaseTime.SetFocus
Exit Sub
End If
If Trim(cob_Mode.Text) = "日" Then
If Val(txtWorkDays) = 0 And Val(txtWeekEndCount) = 0 Then
MsgBox ("请输入按日租赁的工作日或者周末个数")
txtWorkDays.SetFocus
Exit Sub
End If
Else
If Val(txtWorkDays) = 0 Then
MsgBox ("请输入租赁的周数或者月份数")
txtWorkDays.SetFocus
Exit Sub
End If
End If
With MyLease
.CarNo = MakeStr(txtCarNo)
.CustId = MakeStr(txtCustId)
.LeaseMode = MakeStr(cob_Mode.Text)
If MakeStr(cob_Mode.Text) = "日" Then
.Price1 = AdoPrice.Recordset.Fields(1)
.Price2 = AdoPrice.Recordset.Fields(2)
.WorkDays = Val(txtWorkDays)
.WeekEndCount = Val(txtWeekEndCount)
ElseIf MakeStr(cob_Mode.Text) = "周" Then
.Price1 = AdoPrice.Recordset.Fields(3)
.Price2 = 0
.WorkDays = Val(txtWorkDays)
.WeekEndCount = 0
ElseIf MakeStr(cob_Mode.Text) = "月" Then
.Price1 = AdoPrice.Recordset.Fields(4)
.Price2 = 0
.WorkDays = Val(txtWorkDays)
.WeekEndCount = 0
End If
.DayKM = AdoPrice.Recordset.Fields(5)
.OPrice1 = AdoPrice.Recordset.Fields(6)
.OPrice2 = AdoPrice.Recordset.Fields(7)
.LeaseTime = MakeStr(txtLeaseTime)
.ReturnTime = MakeStr(txtReturnTime)
.Deposit = AdoPrice.Recordset.Fields(0)
.OutKM = Val(txtOutKM)
.Rate = AdoCustomer.Recordset.Fields(5)
.Total = Val(txtCost)
.CreateDate = Date
.UserName = MakeStr(txtUserName)
If Modify = False Then
If .In_DB(Trim(txtContractNo)) = True Then
MsgBox ("已经存在此合同编号")
txtContractNo.SetFocus
Exit Sub
End If
.ContractNo = MakeStr(txtContractNo)
.Status = "出租"
.Insert
Else
.Update (ContractNo)
End If
MsgBox "成功", vbInformation
End With
Unload Me
End Sub
Private Sub Cmd_SchMember_Click()
If Len(Trim(txtCustId)) = 0 Then
MsgBox ("请输入客户号")
txtCustId.SetFocus
Exit Sub
End If
If MyCustomer.In_DB(Trim(txtCustId)) = False Then
MsgBox ("不存在此客户号")
txtCustId.SetFocus
Exit Sub
End If
sCustId = Trim(txtCustId)
CustomerRefresh
End Sub
Private Sub Cmd_SearchCar_Click()
If Len(Trim(txtCarNo)) = 0 Then
MsgBox ("请输入车牌号")
txtCarNo.SetFocus
Exit Sub
End If
If MyCar.GetInfo(Trim(txtCarNo)) = False Then
MsgBox ("不存在此车牌号")
txtCarNo.SetFocus
Exit Sub
Else
If Trim(MyCar.Status) <> "待命" Then
MsgBox ("此车已经出租")
txtCarNo.SetFocus
End If
End If
sCarNo = Trim(txtCarNo)
CarRefresh
CarPriceRefresh
End Sub
Private Sub cob_Mode_Click()
If sCarNo = "" Or sCustId = "" Then
MsgBox ("请先选择车辆和客户信息")
Exit Sub
End If
nCnt = Val(txtWorkDays)
nECnt = Val(txtWeekEndCount)
txtWorkDays.Enabled = True
Label13.Enabled = True
Label14.Enabled = True
If Trim(cob_Mode.Text) = "日" Then
Label13.Caption = "工作日"
Label19.Enabled = True
Label20.Enabled = True
txtWeekEndCount.Enabled = True
lCost = Val(AdoPrice.Recordset.Fields(1)) * nCnt + Val(AdoPrice.Recordset.Fields(2)) * nECnt
txtReturnTime = Trim(DateAdd("d", nCnt + nECnt * 2, CDate(txtLeaseTime)))
ElseIf Trim(cob_Mode.Text) = "周" Then
Label13.Caption = "周数"
Label19.Enabled = False
Label20.Enabled = False
txtWeekEndCount.Enabled = False
lCost = Val(AdoPrice.Recordset.Fields(3)) * nCnt
txtReturnTime = Trim(DateAdd("d", nCnt * 7, CDate(txtLeaseTime)))
ElseIf Trim(cob_Mode.Text) = "月" Then
Label13.Caption = "月份数"
Label19.Enabled = False
Label20.Enabled = False
txtWeekEndCount.Enabled = False
lCost = Val(AdoPrice.Recordset.Fields(4)) * nCnt
txtReturnTime = Trim(DateAdd("m", nCnt, CDate(txtLeaseTime)))
End If
txtCost = lCost * Val(AdoCustomer.Recordset.Fields(5))
End Sub
Public Sub CarRefresh()
AdoCar.ConnectionString = Conn
AdoCar.RecordSource = "SELECT 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 = 1200
DataGrid1.Columns(2).Width = 1000
DataGrid1.Columns(3).Width = 1000
DataGrid1.Columns(4).Width = 1600
End Sub
Public Sub CarPriceRefresh()
AdoPrice.ConnectionString = Conn
AdoPrice.RecordSource = "SELECT Deposit AS 押金,DayPrice AS 工作日价格," _
+ "WeekEndPrice AS 周末价格,WeekPrice AS 周价格,MonthPrice AS 月价格, " _
+ "DayKM AS 日限公里,OverTimePrice AS 超时价格,OverKMPrice AS 超公里价格 " _
+ " FROM Cars WHERE CarNO='" + Trim(sCarNo) + "'"
AdoPrice.Refresh
Set DataGrid2.DataSource = AdoPrice
DataGrid2.Columns(0).Width = 800
DataGrid2.Columns(1).Width = 1000
DataGrid2.Columns(2).Width = 1000
DataGrid2.Columns(3).Width = 1000
DataGrid2.Columns(4).Width = 1000
DataGrid2.Columns(5).Width = 1000
DataGrid2.Columns(6).Width = 1000
DataGrid2.Columns(7).Width = 1000
End Sub
Public Sub CustomerRefresh()
AdoCustomer.ConnectionString = Conn
AdoCustomer.RecordSource = "SELECT c.Name AS 姓名,c.Sex AS 性别," _
+ "c.Telephone AS 电话,c.LicenseNo AS 驾驶证号," _
+ "IIF(c.Flag=0,'',m.TypeName) AS 会员类型," _
+ "IIF(c.Flag=0,1,m.Rate) AS 折扣 " _
+ " FROM Customer c LEFT outer JOIN MemberType m" _
+ " ON c.TypeId=m.Id where c.Id='" + Trim(sCustId) + "'"
AdoCustomer.Refresh
Set DataGrid3.DataSource = AdoCustomer
DataGrid3.Columns(0).Width = 1000
DataGrid3.Columns(1).Width = 700
DataGrid3.Columns(2).Width = 1600
DataGrid3.Columns(3).Width = 1600
DataGrid3.Columns(4).Width = 1000
DataGrid3.Columns(5).Width = 1000
End Sub
Private Sub Form_Load()
cob_Mode.AddItem "日", 0
cob_Mode.AddItem "周", 1
cob_Mode.AddItem "月", 2
End Sub
Private Sub txtWeekEndCount_Change()
If sCarNo = "" Or sCustId = "" Then
MsgBox ("请先选择车辆和客户信息")
Exit Sub
End If
nCnt = Val(txtWorkDays)
nECnt = Val(txtWeekEndCount)
If Trim(cob_Mode.Text) = "日" Then
lCost = Val(AdoPrice.Recordset.Fields(1)) * nCnt + Val(AdoPrice.Recordset.Fields(2)) * nECnt
txtReturnTime = Trim(DateAdd("d", nCnt + nECnt * 2, CDate(txtLeaseTime)))
End If
txtCost = lCost * Val(AdoCustomer.Recordset.Fields(5))
End Sub
Private Sub txtWorkDays_Change()
If sCarNo = "" Or sCustId = "" Then
MsgBox ("请先选择车辆和客户信息")
Exit Sub
End If
nCnt = Val(txtWorkDays)
nECnt = Val(txtWeekEndCount)
If Trim(cob_Mode.Text) = "日" Then
lCost = Val(AdoPrice.Recordset.Fields(1)) * nCnt + Val(AdoPrice.Recordset.Fields(2)) * nECnt
txtReturnTime = Trim(DateAdd("d", nCnt + nECnt * 2, CDate(txtLeaseTime)))
ElseIf Trim(cob_Mode.Text) = "周" Then
lCost = Val(AdoPrice.Recordset.Fields(3)) * nCnt
txtReturnTime = Trim(DateAdd("d", nCnt * 7, CDate(txtLeaseTime)))
ElseIf Trim(cob_Mode.Text) = "月" Then
lCost = Val(AdoPrice.Recordset.Fields(4)) * nCnt
txtReturnTime = Trim(DateAdd("m", nCnt, CDate(txtLeaseTime)))
End If
txtCost = lCost * Val(AdoCustomer.Recordset.Fields(5))
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -