📄 main.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form main
BackColor = &H8000000A&
Caption = "main"
ClientHeight = 3360
ClientLeft = 60
ClientTop = 450
ClientWidth = 6615
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3360
ScaleWidth = 6615
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox waita
BackColor = &H8000000A&
BorderStyle = 0 'None
Enabled = 0 'False
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 975
Left = 360
Locked = -1 'True
MultiLine = -1 'True
TabIndex = 10
Top = 1080
Width = 6015
End
Begin MSComDlg.CommonDialog udlg
Left = 3960
Top = 2880
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton et
Caption = "exit"
Height = 495
Left = 5160
TabIndex = 9
Top = 2160
Width = 1335
End
Begin VB.CommandButton bi
Caption = "bonus import"
Height = 495
Left = 2040
TabIndex = 8
Top = 2760
Width = 1335
End
Begin VB.CommandButton bse
Caption = "bonus sheet export"
Height = 495
Left = 480
TabIndex = 7
Top = 2760
Width = 1335
End
Begin VB.CommandButton bonusprint
Caption = "bonus query by date"
Height = 495
Left = 5160
TabIndex = 6
Top = 480
Width = 1335
End
Begin VB.CommandButton sns
Caption = "cash note setup"
Height = 495
Left = 3600
TabIndex = 5
Top = 2160
Width = 1335
End
Begin VB.CommandButton ss
Caption = "staff setup"
Height = 495
Left = 1920
TabIndex = 4
Top = 2160
Width = 1335
End
Begin VB.CommandButton ctsb
Caption = "cash type setup"
Height = 495
Left = 360
TabIndex = 3
Top = 2160
Width = 1335
End
Begin VB.CommandButton queryandpaybonus
Caption = "query and pay bonus"
Height = 495
Left = 3720
TabIndex = 2
Top = 480
Width = 1335
End
Begin VB.CommandButton cashcheckandexport
Caption = "cashcheck and export"
Height = 495
Left = 1560
TabIndex = 1
Top = 480
Visible = 0 'False
Width = 2055
End
Begin VB.CommandButton DailyOperating
Caption = "Daily Operating"
Height = 495
Left = 120
TabIndex = 0
Top = 480
Width = 1335
End
End
Attribute VB_Name = "main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub bi_Click()
Dim xlsname
udlg.ShowOpen
If Trim(udlg.FileName) = "" Then
MsgBox "pls choose bonus model file"
Exit Sub
Else
xlsname = udlg.FileName
End If
If MsgBox("realy to import the list?", vbYesNo + vbQuestion, "question") = vbYes Then
Dim ExcelApp
Set ExcelApp = CreateObject("excel.application")
ExcelApp.Workbooks.Open (xlsname)
Dim db As Database
Set db = DAO.OpenDatabase(App.Path + "\cashsys.mdb")
Dim rs As Recordset
Set rs = db.OpenRecordset("bonuslist")
waita.Text = "pls wait a moment"
ExcelApp.Visible = False
For r = 2 To ExcelApp.Sheets(1).UsedRange.Rows.count
rs.AddNew
For c = 1 To rs.Fields.count - 1
' MsgBox ExcelApp.Sheets(1).cells(r, c)
If c = 5 Or c = 9 Then
rs.Fields(c) = IIf(Trim(ExcelApp.Sheets(1).cells(r, c).Value) <> "", Format(Trim(ExcelApp.Sheets(1).cells(r, c).Value), "yyyy-MM-dd"), "")
Else
rs.Fields(c) = Trim(ExcelApp.Sheets(1).cells(r, c).Value)
End If
Next c
If r Mod 200 = 0 Then
waita.Text = waita.Text + " ."
End If
rs.Update
Next
waita.Text = ""
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
ExcelApp.quit
Set ExcelApp = Nothing
MsgBox "imported ok"
End If
End Sub
Private Sub bonusprint_Click()
bonusch.Show 1
End Sub
Private Sub bse_Click()
On Error GoTo Err_exportbonus_Click
Dim db As DAO.Database
Set db = DAO.OpenDatabase(App.Path + "\cashsys.mdb")
Dim rs As Recordset
Set rs = db.OpenRecordset("bonuslist")
Call exptoexcel(rs)
MsgBox "export success", vbInformation, "info"
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
Exit_exportbonus_Click:
Exit Sub
Err_exportbonus_Click:
MsgBox Err.Description
Resume Exit_exportbonus_Click
End Sub
Private Sub exptoexcel(rs As DAO.Recordset)
On Error Resume Next
Dim irow, icol, count As Integer
Dim irowcount, icolcount As Integer
Set xlApp = CreateObject("excel.application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
irowcount = rs.RecordCount
icolcount = rs.Fields.count
count = 0
rs.MoveFirst
For icol = 0 To icolcount - 1
xlSheet.cells(1, icol).Value = rs.Fields(icol).Name '加标头;
Next icol
irow = 2
waita.Text = "pls wait a moment"
Do While Not rs.EOF
For icol = 0 To icolcount - 1
' DoEvents
xlSheet.cells(irow, icol).Value = rs.Fields(icol) '加标头;
Next icol
If irow Mod 200 = 0 Then
waita.Text = waita.Text + " ."
End If
irow = irow + 1
rs.MoveNext
Loop
xlApp.Visible = True
xlApp.save
xlApp.quit
waita.Text = ""
Set xlApp = Nothing
End Sub
Private Sub ctsb_Click()
cts.Show 1
End Sub
Private Sub DailyOperating_Click()
dailyoper.Show 1
End Sub
Private Sub et_Click()
End
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub
Private Sub queryandpaybonus_Click()
queryPayBonuse.Show 1
End Sub
Private Sub sns_Click()
cashnote.Show 1
End Sub
Private Sub ss_Click()
persons.Show 1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -