?? frmaccupgrade.frm
字號:
sqlstr = "update fd_Vouch set Cacc1_id='" & .TextMatrix(i + 1, 1) & "' where Cacc1_id='" & .TextMatrix(i + 1, 0) & "'"
con.Execute sqlstr
sqlstr = "update fd_Vouch set Cacc2_id='" & .TextMatrix(i + 1, 1) & "' where Cacc2_id='" & .TextMatrix(i + 1, 0) & "'"
con.Execute sqlstr
Me.ProgressBar1.Value = .Rows - i - 1
iResult = i Mod 10
If iResult = 0 Then
DoEvents
Label8.Caption = "已處理" & .Rows - i - 1 & "條"
End If
Next
End With
Debug.Print "after insert " & Time
con.CommitTrans
SaveData = True
Exit Function
Else
SaveData = False
Exit Function
End If
Error0:
MsgBox Err.Description
SaveData = False
Exit Function
Error1:
con.RollbackTrans
MsgBox "保存失敗", vbInformation, "賬號升級"
SaveData = False
' If con.State = adStateOpen Then
' con.Close
' End If
' Set con = Nothing
End Function
Private Sub saveProc()
Dim result As VbMsgBoxResult
result = MsgBox("保存升級信息之前,請退出資金管理其他應用!" & vbCrLf & "否則可能導致其他應用的數據錯誤!" & vbCrLf & "確定要保存嗎!", vbYesNo, "保存數據")
Select Case result
Case vbYes
Case vbNo
Exit Sub
End Select
If SaveData Then
'set toobool statues
Frame2.Visible = False
With tlbTool
.Buttons("cmdyulan").Enabled = True
.Buttons("print").Enabled = True
.Buttons("preview").Enabled = True
.Buttons("output").Enabled = True
.Buttons("search").Enabled = True
.Buttons("cancel").Enabled = False
.Buttons("save").Enabled = False
End With
'set commondbutton statues
'cmdYuLan.Enabled = True
modified = False
Call fillGrid(True)
End If
Frame2.Visible = False
End Sub
'check input data
Private Function CheckData() As Boolean
Dim i As Long
Dim j As Long
Dim rsacc As New UfRecordset
With SuperGrid1
' For i = 1 To .Rows - 2
' For j = i + 1 To .Rows - 1
' If .TextMatrix(i, 1) = .TextMatrix(j, 0) Then
' MsgBox "錯誤!第" & i & "行新賬戶號與第" & j & "行舊賬戶號相同", vbInformation, "賬號升級"
' CheckData = False
' Exit Function
' End If
'' If .TextMatrix(i, 1) = .TextMatrix(j, 1) Then
'' MsgBox "錯誤!第" & i & "行新賬戶號與第" & j & "行新賬戶號相同", vbInformation, "賬號升級"
'' CheckData = False
'' Exit Function
'' End If
' Next
' Next
Debug.Print "after check duplicate" & Time
Frame2.Visible = True
Frame2.top = Me.Height / 2 - Frame2.Height / 2
Frame2.left = Me.width / 2 - Frame2.width / 2
Label6.Caption = "正在做合法性校驗!請等待......"
Label7.Caption = "共有記錄" & SuperGrid1.Rows - 1 & "條"
Me.ProgressBar1.Max = .Rows - 1
Dim iResult As Integer
DoEvents
For i = 1 To .Rows - 1
sqlstr = "select count(*) from fd_accdef where Caccid='" & .TextMatrix(i, 1) & "'"
Set rsacc = dbsZJ.OpenRecordset(sqlstr, dbOpenSnapshot)
If rsacc(0) <> 0 Then
MsgBox "第" & i & "行數據在賬號表中已存在!" & vbCrLf & "請更改后重試保存操作!", vbInformation, "賬號升級"
CheckData = False
Frame2.Visible = False
Exit Function
End If
Me.ProgressBar1.Value = i
iResult = i Mod 100
If iResult = 0 Then
DoEvents
Label8.Caption = "已處理" & i & "條"
End If
Next
End With
CheckData = True
Debug.Print "after sql" & Time
End Function
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim result As VbMsgBoxResult
'If credstat.modified Then
If ((Not tlbTool.Buttons("cmdyulan").Enabled) And tlbTool.Buttons("save").Enabled) Then
result = MsgBox("您還有數據未保存,是否決定在退出貸款額度程序時保存數據?", vbYesNoCancel, "退出程序")
Select Case result
Case vbYes
If SaveData Then
Cancel = 0
Else
Cancel = 1
Frame2.Visible = False
Exit Sub
End If
Case vbNo
Cancel = 0
Case vbCancel
Cancel = 1
Exit Sub
End Select
End If
If con.State = adStateOpen Then
con.Close
End If
Set con = Nothing
frmQuqeryAcc.m_accUpgrade = 0
End Sub
Private Sub Form_Resize()
ResizeTlb Me
If Me.WindowState <> 1 Then
Label1.top = tlbTool.Height + 150
Edit1.top = Label1.top
cmdDateRef.top = Label1.top
SuperGrid1.top = Label1.top + 300
If Me.width - Label1.top - Edit1.Height - 2400 > 0 Then
SuperGrid1.Height = Me.Height - Label1.top - Edit1.Height - 1800
SuperGrid1.width = Me.width - 200
Label2(0).top = SuperGrid1.top + SuperGrid1.Height + 150
Edit1.top = Label2(0).top + 250
Label2(3).top = Edit2.top
Label2(1).top = Label2(0).top + 250
Label2(2).top = Label2(1).top + 250
Label2(3).top = Label2(2).top + 250
Label3.top = Label2(1).top
Label4.top = Label2(1).top
Label5.top = Label4.top
Frame1.top = Label2(1).top - 120
optWz2(0).top = Frame1.top
optWz2(1).top = optWz2(0).top + 240
txtbcws.top = Label2(2).top
Edit2.top = Label2(3).top
End If
End If
End Sub
Private Sub ocxCtbTool_OnCommand(ByVal enumType As prjTBCtrl.ENUM_MENU_OR_BUTTON, ByVal cButtonId As String, ByVal cMenuId As String)
tlbTool_ButtonClick tlbTool.Buttons(cButtonId)
End Sub
Private Sub optWz1_GotFocus(index As Integer)
If txtSjrq.Enabled Then
cmdDateRef.Visible = False
End If
End Sub
Private Sub SuperGrid1_CellDataCheck(RetValue As String, RetState As MsSuperGrid.OpType, ByVal R As Long, ByVal C As Long)
count_i = count_i + 1
Debug.Print errorNUM & count_i & error_Edit & "cell_data_check)"
Screen.MousePointer = vbHourglass
If errorNUm1 = 0 Then
Call checkDup(R, C)
'errorNUm1 = 1
Else
errorNUm1 = 0
End If
Screen.MousePointer = vbDefault
If error_Edit Then
SuperGrid1.row = R
SuperGrid1.col = C
SuperGrid1.SetFocus
End If
End Sub
Private Sub SuperGrid1_GotFocus()
If txtSjrq.Enabled Then
cmdDateRef.Visible = False
End If
End Sub
Private Sub SuperGrid1_LostFocus()
count_i = count_i + 1
Debug.Print errorNUM & count_i & error_Edit & "lostfocus"
SuperGrid1.ProtectUnload
Debug.Print errorNUM & error_Edit & "lostfocus after protextunload"
If error_Edit Then
If errorNUM = 0 Then
MsgBox "請先改正輸入錯誤!", vbInformation, "賬號升級"
errorNUM = 1
SuperGrid1.row = selrow
SuperGrid1.col = selcol
SuperGrid1.SetFocus
Else
errorNUM = 0
End If
End If
End Sub
Private Sub SuperGrid1_RowColChange()
If Not tlbTool.Buttons("cmdyulan").Enabled Then
If SuperGrid1.col = 1 Then
SuperGrid1.ReadOnly = False
Else
SuperGrid1.ReadOnly = True
End If
Else
SuperGrid1.ReadOnly = True
End If
count_i = count_i + 1
Debug.Print errorNUM & count_i & error_Edit & "errornum rowcolchange"
If error_Edit Then
If errorNUM = 0 And errorNUm1 = 0 Then
MsgBox "請先改正輸入錯誤!", vbInformation, "賬號升級"
errorNUM = 1
SuperGrid1.row = selrow
SuperGrid1.col = selcol
SuperGrid1.SetFocus
Else
errorNUM = 0
End If
End If
End Sub
'初始化打印數據XML文件
Private Sub initPrnXmlFile()
'過程變量
Dim prnxml As New clsPrnXml
Dim AttrName() As String
Dim AttrValue() As String
Dim i, j As Integer
Dim str1 As String
On Error GoTo Error0
'插入結構數據數據
str1 = "賬號升級信息"
prnxml.Initialize "數據", "任務"
prnxml.InsertPNode "任務", "頁眉", "第%p頁,共%p頁"
prnxml.InsertPNode "任務", "標題", str1
prnxml.InsertPNode "任務", "表頭", ""
prnxml.InsertPNode "任務", "表體", ""
prnxml.InsertPNode "任務", "表尾", ""
prnxml.InsertPNode "任務", "頁腳", "用友軟件"
ReDim AttrName(0, 1)
ReDim AttrValue(0)
'插入表頭,表尾數據
For i = 0 To UBound(AttrName)
AttrName(i, 0) = "名字"
Next
'插入表頭,表尾數據
AttrName(0, 1) = "升級日期"
AttrValue(0) = CStr(Format(txtSjrq.Text, "YYYY-MM-DD"))
prnxml.InsertHeadNodes "表頭", "字段", AttrName, AttrValue
'插入表體頭數據
ReDim AttrName(6, 1)
ReDim AttrValue(6)
For i = 0 To 6
AttrName(i, 0) = "單元"
Next
AttrValue(0) = "新賬戶號"
AttrValue(1) = "舊賬戶號"
AttrValue(2) = "賬戶名稱"
AttrValue(3) = "單位名稱"
AttrValue(4) = "開戶日期"
AttrValue(5) = "開戶銀行"
AttrValue(6) = "幣別"
prnxml.InsertBodyNodes "表體", "表體頭", AttrName, AttrValue
For i = 0 To 6
AttrValue(i) = ""
Next
'插入表體行數據
With SuperGrid1
For i = 1 To .Rows - 1
AttrValue(0) = .TextMatrix(i, 1)
AttrValue(1) = .TextMatrix(i, 0)
AttrValue(2) = .TextMatrix(i, 2)
AttrValue(3) = .TextMatrix(i, 3)
AttrValue(4) = .TextMatrix(i, 4)
AttrValue(5) = .TextMatrix(i, 5)
AttrValue(6) = .TextMatrix(i, 6)
prnxml.InsertBodyNodes "表體", "表體行", AttrName, AttrValue
Next
End With
'保存數據文件
prnxml.saveFile "taccUpData.xml"
If initStyleXml Then
If prnDataBind Then
xmlInit = True
Else
xmlInit = False
End If
Else
xmlInit = False
End If
Set prnxml = Nothing
Exit Sub
Error0:
MsgBox "打印數據準備失敗!" & vbCrLf & Err.Description, vbInformation, "錯誤信息"
' If rs.State = adStateOpen Then
' rs.Close
' End If
xmlInit = False
Set prnxml = Nothing
End Sub
Private Function prnDataBind() As Boolean
Dim lRet As Long
Dim sData As String
Dim sStyle As String
Dim sModuleId As String
sData = App.Path & "\taccUpdata.xml"
sStyle = App.Path & "\taccUpStyle.xml"
sModuleId = "default"
lRet = Printer.SetDataStyleXML(sData, 1, sStyle, 1, sModuleId)
If lRet = 0 Then
prnDataBind = True
Else
prnDataBind = False
MsgBox "打印數據準備失敗!", vbInformation, "錯誤信息"
End If
End Function
'打印處理程序
Private Sub printProc()
If Not xmlInit Then
Call initPrnXmlFile
End If
If xmlInit Then
Printer.DoPrint
xmlInit = False
End If
End Sub
'預覽處理程序
Private Sub previewProc()
If Not xmlInit Then
Call initPrnXmlFile
End If
If xmlInit Then
Printer.PrintPreview
xmlInit = False
End If
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -