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

📄 frmreturnedit.frm

📁 机动车租赁管理就是对车辆信息和客户信息的管理
💻 FRM
📖 第 1 页 / 共 3 页
字号:
      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

⌨️ 快捷键说明

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