frm_rpair.frm

来自「汽修厂管理软件」· FRM 代码 · 共 1,041 行 · 第 1/3 页

FRM
1,041
字号
      Comb_Car.AddItem mRsRepairing.Fields("车牌")
      mRsRepairing.MoveNext
      Loop
     
    If Comb_Car.ListCount > 0 Then
     Comb_Car.ListIndex = 0
     Else
      RepairClear
      Comb_Car.AddItem "粤A"
     Comb_Car.ListIndex = 0
     Cmd_AddPart.Enabled = False
     Cmd_Labor.Enabled = False
    CMd_PrintGujia.Enabled = False
    Cmd_Begin.Enabled = False
    Cmd_Finished.Enabled = False
    Cmd_Delete.Enabled = False
    End If
    Comb_ZhuangTai.AddItem "维修"
    Comb_ZhuangTai.AddItem "返修"
    mRsRepairing.Close
    Txt_Sum.Text = CStr(sngSumFee(Grid_Part) + sngSumFee(Grid_Labor))
    Txt_Date.Text = Date
    Txt_JieCheYuan.Text = Frm_Login.Txt_Name.Text
    Exit Sub
 End If
ErrHandle:
 If strOkorEsc = "确定" Then
   If Err.Number = 3112 Then
     MsgBox "您无权进入", vbInformation + vbOKOnly, STRGARAGE
     Else
     MsgBox Err.Description, vbCritical + vbOKOnly, STRGARAGE
   End If
 End If
 Unload Me

End Sub

Sub ShowSetup(mRstemp As Recordset)
  Dim strTemp As String
  Dim i As Integer
  
  Txt_CarParameter.Text = ""
  For i = 2 To 7
   strTemp = mRstemp.Fields(i) & ""
    If strTemp <> "" Then
      Txt_CarParameter.Text = Txt_CarParameter.Text & mRstemp.Fields(i).Name & ":" & mRstemp.Fields(i) & "; "
     End If
  Next i
  txt_Custom.Text = mRstemp.Fields("联系人") & ""
  Txt_Date.Text = CStr(mRstemp.Fields("送修日期"))
  
  Exit Sub
End Sub



Private Sub Cmd_AddPart_Click()
Dim mRs As Recordset
 Dim rsWait As Recordset
 STRCURRENTCARNUMBER = Comb_Car.Text
Set rsWait = DBSGRG.OpenRecordset("Select * from 待修表 Where 车牌 = '" & STRCURRENTCARNUMBER & "'", dbOpenSnapshot)
If rsWait.RecordCount = 0 Then
  If MsgBox("您还没有为" & STRCURRENTCARNUMBER & "做入厂登记,是否入厂估价?", vbYesNo, STRGARAGE) = vbYes Then
   Set mRs = DBSGRG.OpenRecordset("待修表", dbOpenTable, dbAppendOnly) '将它借用于carRecord
     With mRs
      .AddNew
      !车牌 = Comb_Car.Text
      !状态 = "估价"
      !送修日期 = Date
      !接车员 = Frm_Login.Txt_Name.Text
      .Update
     End With
    mRs.Close
    
    Grid_Part.Rows = 1
    Grid_Labor.Rows = 1
  Else
    Exit Sub
  End If
  
End If
Call ReadFromTBLWait(rsWait, Frm_AddPart.Grid_SelectedPart, "材料")

Frm_AddPart.Show
rsWait.Close

End Sub



Private Sub Txt_PartSum_GotFocus()
Beep
Comb_Car.SetFocus
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim objLoop As Object
 For Each objLoop In Me
  If TypeName(objLoop) = "TextBox" Then objLoop.BackColor = &H8000000F
 Next objLoop
End Sub

Private Sub Txt_CarParameter_GotFocus()
Beep
Comb_Car.SetFocus
End Sub


Sub DelBolder()
Dim EachControl As Control

For Each EachControl In Me.Controls

If InStr(1, EachControl.Name, "Cmd") > 0 Then
   EachControl.Visible = False
 Else
   If InStr(1, EachControl.Name, "Sta") > 0 Then
          EachControl.Visible = False
       Else
          EachControl.Appearance = 0
   End If
End If
Next EachControl

End Sub
Sub RecoverBolder()

Dim EachControl As Control

For Each EachControl In Me.Controls

If InStr(1, EachControl.Name, "Cmd") > 0 Then
   EachControl.Visible = False
 Else
   If InStr(1, EachControl.Name, "Sta") > 0 Then
          EachControl.Visible = True
       Else
          EachControl.Appearance = 1
   End If
End If
Next EachControl


End Sub



Sub PrintGujia(mgrid_Part As MSFlexGrid, mGrid_Labor As MSFlexGrid, Left As Single, Top As Single, Right As Single, Bottom As Single)
'left为打印区的X坐标,top为打印区的Y坐标
Dim intRows  As Integer
Dim intMaxRows
Dim intPages As Integer
Dim strPart() As String
Dim strLabor() As String
Dim sngTabLeftPart(4) As Single
Dim sngTabLeftLabor(7) As Single
Dim intX As Integer
Dim intY As Integer
Dim Page_i As Integer
Dim Row_i As Integer
Dim sngCenter As Single '表的中线位置
Dim TabLeft As Single
Dim TabRight As Single
Dim tabTop As Single
Dim tabBottom As Single
TabLeft = Left + 2
TabRight = Right - 2
tabTop = 0.1789 * (Bottom - Top) + Top
tabBottom = 0.81 * (Bottom - Top) + Top
intMaxRows = (tabBottom - tabTop - 8) \ 4.5
intRows = mgrid_Part.Rows - 1
If mGrid_Labor.Rows > mgrid_Part.Rows Then intRows = mGrid_Labor.Rows
If intRows Mod intMaxRows > 0 Then
   intPages = intRows \ intMaxRows + 1
   Else
   intPages = intRows \ intMaxRows
End If

'ReDim strPart(mgrid_Part.Cols)
'ReDim strLabor(mGrid_Labor.Cols)
sngCenter = (TabLeft + TabRight) / 2
'设置单位
Printer.ScaleMode = vbMillimeters
 Printer.ScaleHeight = 99
 Printer.ScaleWidth = 210
 
 
sngTabLeftPart(0) = 0
sngTabLeftPart(1) = 0.253
sngTabLeftPart(2) = 0.493 + 0.253
sngTabLeftPart(3) = 0.113 + 0.253 + 0.493
sngTabLeftLabor(0) = 0
sngTabLeftLabor(2) = 0.5
sngTabLeftLabor(3) = 0.6
sngTabLeftLabor(4) = 0.7
sngTabLeftLabor(5) = 0.8
sngTabLeftLabor(6) = 0.9
For Page_i = 1 To intPages
'画四边的边框
Printer.DrawWidth = 8
Printer.Line (TabLeft, tabTop)-(TabRight, tabTop)
Printer.Line (TabLeft, tabTop)-(TabLeft, tabBottom)
Printer.Line -(TabRight, tabBottom)
Printer.Line -(TabRight, tabTop)
'画中竖线
Printer.DrawWidth = 8
Printer.Line ((TabLeft + TabRight) / 2, tabTop)-((TabLeft + TabRight) / 2, tabBottom)
'画第二条横线
Printer.DrawWidth = 2
Printer.Line (TabLeft, tabTop + 7)-(TabRight, tabTop + 7)



With Printer
.CurrentX = sngCenter - (CSng(Len(Trim(STRGARAGE)) + 3)) * 7 / 2
.CurrentY = Top
.FontSize = 20
End With
Printer.Font.Underline = True
Printer.Print Trim(STRGARAGE) & "估价单"
Printer.CurrentX = TabLeft + 1
Printer.CurrentY = 0.1052 * (Bottom - Top) + Top
Printer.FontSize = 10
Printer.Font.Underline = False
Printer.Print "车牌:"
Printer.CurrentX = 0.175 * (TabRight - TabLeft) + TabLeft
Printer.CurrentY = 0.1052 * (Bottom - Top) + Top
Printer.Print "送修时间:"
Printer.CurrentX = 0.34 * (TabRight - TabLeft) + TabLeft
Printer.CurrentY = 0.1052 * (Bottom - Top) + Top
Printer.Print "车主姓名:"

Printer.Font.Underline = True
Printer.CurrentX = TabLeft + 9.5
Printer.CurrentY = 0.1052 * (Bottom - Top) + Top
Printer.Print Comb_Car.Text
Printer.CurrentX = 0.175 * (TabRight - TabLeft) + TabLeft + 17
Printer.CurrentY = 0.1052 * (Bottom - Top) + Top
Printer.Print Txt_Date.Text
Printer.CurrentX = 0.34 * (TabRight - TabLeft) + TabLeft + 17
Printer.CurrentY = 0.1052 * (Bottom - Top) + Top
Printer.Print txt_Custom.Text

Printer.Font.Underline = False
Printer.CurrentX = TabRight - 23
Printer.CurrentY = 0.1052 * (Bottom - Top) + Top
Printer.Print "共" & CStr(intPages) & "页,第" & CStr(Page_i) & "页"

Printer.CurrentX = Left + 1
Printer.CurrentY = tabBottom + 8
Printer.Print "车主签名 _______________                   接车员___________________"

 

   Printer.FontSize = 10
  
   For intX = 1 To mgrid_Part.Cols - 2
      Printer.CurrentY = tabTop + 2
      Printer.CurrentX = TabLeft + (TabRight - TabLeft) / 2 * sngTabLeftPart(intX - 1) + 2
      Printer.Print mgrid_Part.TextMatrix(0, intX)
   Next intX
   
   For intY = intMaxRows * (Page_i - 1) + 1 To intMaxRows * (Page_i - 1) + intMaxRows
    If intY < mgrid_Part.Rows Then
        For intX = 1 To mgrid_Part.Cols - 2
           Printer.CurrentX = TabLeft + (TabRight - TabLeft) / 2 * sngTabLeftPart(intX - 1) + 2
           Printer.CurrentY = tabTop + 4 * (intY - (Page_i - 1) * intMaxRows - 1) + 8
           Printer.Print mgrid_Part.TextMatrix(intY, intX)
        Next intX
   End If
   Next intY
   
   For intX = 0 To mGrid_Labor.Cols - 1
    If intX <> 1 Then
      Printer.CurrentY = tabTop + 2
      Printer.CurrentX = (TabRight - TabLeft) / 2 * sngTabLeftLabor(intX) + 2 + sngCenter
      Printer.Print mGrid_Labor.TextMatrix(0, intX)
      End If
   Next intX
   
   For intY = intMaxRows * (Page_i - 1) + 1 To intMaxRows * (Page_i - 1) + intMaxRows
    If intY < mGrid_Labor.Rows Then
        For intX = 0 To mGrid_Labor.Cols - 1
          If intX <> 1 Then
           Printer.CurrentX = (TabRight - TabLeft) / 2 * sngTabLeftLabor(intX) + 2 + sngCenter
           Printer.CurrentY = tabTop + 8 + 4 * (intY - (Page_i - 1) * intMaxRows - 1)
            If mGrid_Labor.TextMatrix(0, intX) = "折扣" Then
               Printer.Print mGrid_Labor.TextMatrix(intY, intX) & "%"
              Else
               Printer.Print mGrid_Labor.TextMatrix(intY, intX)
            End If
          End If
        Next intX
   End If
   Next intY
   If Page_i = intPages Then
    Printer.CurrentX = TabLeft + 1
    Printer.CurrentY = tabBottom + 1
    Printer.Print "总计金额:" & Txt_Sum.Text & "元"
    Debug.Print Printer.CurrentX
    Printer.CurrentX = Right - 0.275 * Len("[" & STRGRGINFO & "]")
    Printer.CurrentY = tabBottom + 1
    Printer.FontSize = 8
    Printer.Print "[" & STRGRGINFO & "]"
   End If
   Printer.EndDoc
   
Next Page_i
End Sub

Sub RepairClear()
 Dim objLoop As Object
 
 For Each objLoop In Me
  If TypeName(objLoop) = "TextBox" Or TypeName(objLoop) = "ComboBox" Then objLoop.Text = ""
 Next objLoop
 Txt_Date.Text = CStr(Date)
 Txt_JieCheYuan.Text = WKSGRG.UserName
 Grid_Labor.Rows = 1
 Grid_Part.Rows = 1
End Sub


Private Sub Txt_CarParameter_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Txt_CarParameter.BackColor = &H80000005
End Sub



Private Sub txt_Custom_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
txt_Custom.BackColor = &H80000005
End Sub


Private Sub Txt_Date_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Txt_Date.BackColor = &H80000005
End Sub


Private Sub Txt_JieCheYuan_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Txt_JieCheYuan.BackColor = &H80000005
End Sub

Private Sub Txt_Sum_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Txt_Sum.BackColor = &H80000005
End Sub

⌨️ 快捷键说明

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