www.pudn.com > vb625557712344.rar > FrmLeaseEdit.frm, change:2005-06-07,size:30033b


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 FrmLeaseEdit  
   Caption         =   "编辑汽车出租信息" 
   ClientHeight    =   6375 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   8640 
   LinkTopic       =   "Form1" 
   Picture         =   "FrmLeaseEdit.frx":0000 
   ScaleHeight     =   6375 
   ScaleWidth      =   8640 
   StartUpPosition =   2  '屏幕中心 
   Begin VB.TextBox txtContractNo  
      Height          =   330 
      Left            =   1080 
      TabIndex        =   20 
      Top             =   100 
      Width           =   2895 
   End 
   Begin VB.CommandButton Cmd_Cancel  
      Caption         =   "取 消" 
      Height          =   375 
      Left            =   4800 
      MouseIcon       =   "FrmLeaseEdit.frx":E2C4 
      TabIndex        =   18 
      Top             =   5880 
      Width           =   1095 
   End 
   Begin VB.CommandButton Cmd_OK  
      Caption         =   "确 定" 
      Height          =   375 
      Left            =   2400 
      MouseIcon       =   "FrmLeaseEdit.frx":E5CE 
      TabIndex        =   17 
      Top             =   5880 
      Width           =   1095 
   End 
   Begin VB.Frame Frame4  
      Caption         =   "租赁信息" 
      Height          =   1455 
      Left            =   120 
      TabIndex        =   8 
      Top             =   4320 
      Width           =   8415 
      Begin VB.TextBox txtOutKM  
         Height          =   300 
         Left            =   6840 
         TabIndex        =   33 
         Text            =   "0" 
         Top             =   300 
         Width           =   1095 
      End 
      Begin VB.TextBox txtWeekEndCount  
         Height          =   300 
         Left            =   4680 
         TabIndex        =   28 
         Text            =   "0" 
         Top             =   300 
         Width           =   495 
      End 
      Begin VB.TextBox txtWorkDays  
         Height          =   300 
         Left            =   3120 
         TabIndex        =   25 
         Text            =   "0" 
         Top             =   300 
         Width           =   495 
      End 
      Begin VB.TextBox txtCost  
         Enabled         =   0   'False 
         Height          =   300 
         Left            =   960 
         TabIndex        =   23 
         Text            =   "0" 
         Top             =   1020 
         Width           =   735 
      End 
      Begin VB.ComboBox cob_Mode  
         Height          =   300 
         Left            =   960 
         Style           =   2  'Dropdown List 
         TabIndex        =   16 
         Top             =   300 
         Width           =   1095 
      End 
      Begin VB.TextBox txtUserName  
         Height          =   300 
         Left            =   2640 
         TabIndex        =   15 
         Top             =   1020 
         Width           =   1095 
      End 
      Begin VB.TextBox txtReturnTime  
         Enabled         =   0   'False 
         Height          =   300 
         Left            =   3960 
         TabIndex        =   14 
         Top             =   660 
         Width           =   1815 
      End 
      Begin VB.TextBox txtLeaseTime  
         Height          =   300 
         Left            =   960 
         TabIndex        =   13 
         Top             =   660 
         Width           =   1815 
      End 
      Begin VB.Label Label1  
         AutoSize        =   -1  'True 
         Caption         =   "出车公里数" 
         Height          =   180 
         Left            =   5760 
         TabIndex        =   34 
         Top             =   360 
         Width           =   900 
      End 
      Begin VB.Label Label20  
         AutoSize        =   -1  'True 
         Caption         =   "个" 
         Height          =   180 
         Left            =   5280 
         TabIndex        =   29 
         Top             =   360 
         Width           =   180 
      End 
      Begin VB.Label Label19  
         AutoSize        =   -1  'True 
         Caption         =   "周末" 
         Height          =   180 
         Left            =   4080 
         TabIndex        =   27 
         Top             =   360 
         Width           =   360 
      End 
      Begin VB.Label Label14  
         AutoSize        =   -1  'True 
         Caption         =   "个" 
         Height          =   180 
         Left            =   3720 
         TabIndex        =   26 
         Top             =   360 
         Width           =   180 
      End 
      Begin VB.Label Label13  
         AutoSize        =   -1  'True 
         Caption         =   "工作日" 
         Height          =   180 
         Left            =   2460 
         TabIndex        =   24 
         Top             =   360 
         Width           =   540 
      End 
      Begin VB.Label Label5  
         AutoSize        =   -1  'True 
         Caption         =   "租车费用" 
         Height          =   180 
         Left            =   120 
         TabIndex        =   22 
         Top             =   1080 
         Width           =   720 
      End 
      Begin VB.Label Label34  
         AutoSize        =   -1  'True 
         Caption         =   "经办人" 
         Height          =   180 
         Left            =   1920 
         TabIndex        =   12 
         Top             =   1080 
         Width           =   540 
      End 
      Begin VB.Label Label33  
         AutoSize        =   -1  'True 
         Caption         =   "还车时间" 
         Height          =   180 
         Left            =   3120 
         TabIndex        =   11 
         Top             =   720 
         Width           =   720 
      End 
      Begin VB.Label Label31  
         AutoSize        =   -1  'True 
         Caption         =   "租车时间" 
         Height          =   180 
         Left            =   120 
         TabIndex        =   10 
         Top             =   720 
         Width           =   720 
      End 
      Begin VB.Label Label12  
         AutoSize        =   -1  'True 
         Caption         =   "租赁模式" 
         Height          =   180 
         Left            =   120 
         TabIndex        =   9 
         Top             =   360 
         Width           =   720 
      End 
   End 
   Begin VB.Frame Frame2  
      Caption         =   "客户信息" 
      Height          =   1335 
      Left            =   120 
      TabIndex        =   5 
      Top             =   2880 
      Width           =   8415 
      Begin MSAdodcLib.Adodc AdoCustomer  
         Height          =   375 
         Left            =   5280 
         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 DataGrid3  
         Height          =   495 
         Left            =   120 
         TabIndex        =   32 
         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_SchMember  
         Caption         =   "查找" 
         Height          =   375 
         Left            =   2280 
         TabIndex        =   21 
         Top             =   240 
         Width           =   735 
      End 
      Begin VB.TextBox txtCustId  
         BeginProperty DataFormat  
            Type            =   0 
            Format          =   "yyyy-MM-dd" 
            HaveTrueFalseNull=   0 
            FirstDayOfWeek  =   0 
            FirstWeekOfYear =   0 
            LCID            =   2052 
            SubFormatType   =   0 
         EndProperty 
         Height          =   300 
         Left            =   960 
         TabIndex        =   6 
         Top             =   300 
         Width           =   1095 
      End 
      Begin VB.Label Label6  
         AutoSize        =   -1  'True 
         Caption         =   "客户编号" 
         Height          =   180 
         Left            =   120 
         TabIndex        =   7 
         Top             =   360 
         Width           =   720 
      End 
   End 
   Begin VB.Frame Frame3  
      Caption         =   "租赁价格" 
      Height          =   855 
      Left            =   120 
      TabIndex        =   4 
      Top             =   1920 
      Width           =   8415 
      Begin MSDataGridLib.DataGrid DataGrid2  
         Height          =   495 
         Left            =   120 
         TabIndex        =   31 
         Top             =   240 
         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 MSAdodcLib.Adodc AdoPrice  
         Height          =   375 
         Left            =   5760 
         Top             =   120 
         Visible         =   0   'False 
         Width           =   2655 
         _ExtentX        =   4683 
         _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         =   "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