583 lines
15 KiB
Plaintext
583 lines
15 KiB
Plaintext
VERSION 5.00
|
|
Object = "{00025600-0000-0000-C000-000000000046}#5.2#0"; "Crystl32.OCX"
|
|
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
|
|
Begin VB.Form frmRepList
|
|
Caption = "Report List"
|
|
ClientHeight = 5085
|
|
ClientLeft = 60
|
|
ClientTop = 345
|
|
ClientWidth = 8115
|
|
KeyPreview = -1 'True
|
|
LinkTopic = "Form1"
|
|
ScaleHeight = 5085
|
|
ScaleWidth = 8115
|
|
StartUpPosition = 3 'Windows Default
|
|
Begin MSComDlg.CommonDialog CMDialog1
|
|
Left = 7575
|
|
Top = 2445
|
|
_ExtentX = 847
|
|
_ExtentY = 847
|
|
_Version = 393216
|
|
End
|
|
Begin VB.CommandButton cmdPrnSetup
|
|
Caption = "Printer Set&up"
|
|
BeginProperty Font
|
|
Name = "MS Sans Serif"
|
|
Size = 9.75
|
|
Charset = 0
|
|
Weight = 700
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
Height = 615
|
|
Left = 5475
|
|
TabIndex = 16
|
|
TabStop = 0 'False
|
|
Top = 4485
|
|
Width = 1275
|
|
End
|
|
Begin VB.CommandButton cmdDelete
|
|
Caption = "&Delete Report"
|
|
BeginProperty Font
|
|
Name = "MS Sans Serif"
|
|
Size = 9.75
|
|
Charset = 0
|
|
Weight = 700
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
Height = 615
|
|
Left = 5475
|
|
TabIndex = 15
|
|
TabStop = 0 'False
|
|
Top = 3765
|
|
Width = 1275
|
|
End
|
|
Begin Crystal.CrystalReport crRepList
|
|
Left = 6855
|
|
Top = 2505
|
|
_ExtentX = 741
|
|
_ExtentY = 741
|
|
_Version = 348160
|
|
PrintFileLinesPerPage= 60
|
|
End
|
|
Begin VB.TextBox txtCopy
|
|
Alignment = 1 'Right Justify
|
|
Height = 285
|
|
Left = 6075
|
|
TabIndex = 13
|
|
Top = 2685
|
|
Width = 375
|
|
End
|
|
Begin VB.Frame fraDestination
|
|
Caption = "Destination "
|
|
Height = 1080
|
|
Left = 5400
|
|
TabIndex = 10
|
|
Top = 1560
|
|
Width = 1335
|
|
Begin VB.OptionButton optDest
|
|
Caption = "Excell"
|
|
Height = 225
|
|
Index = 2
|
|
Left = 180
|
|
TabIndex = 17
|
|
Top = 795
|
|
Width = 1065
|
|
End
|
|
Begin VB.OptionButton optDest
|
|
Caption = "Printer"
|
|
Height = 195
|
|
Index = 1
|
|
Left = 180
|
|
TabIndex = 12
|
|
Top = 517
|
|
Width = 975
|
|
End
|
|
Begin VB.OptionButton optDest
|
|
Caption = "Window"
|
|
Height = 195
|
|
Index = 0
|
|
Left = 180
|
|
TabIndex = 11
|
|
Top = 240
|
|
Value = -1 'True
|
|
Width = 1095
|
|
End
|
|
End
|
|
Begin VB.TextBox txtDesc
|
|
Height = 615
|
|
Left = 5400
|
|
MultiLine = -1 'True
|
|
TabIndex = 6
|
|
Top = 900
|
|
Width = 2655
|
|
End
|
|
Begin VB.TextBox txtFile
|
|
Height = 315
|
|
Left = 5400
|
|
TabIndex = 5
|
|
Top = 300
|
|
Width = 2655
|
|
End
|
|
Begin VB.CommandButton cmdExit
|
|
Caption = "E&xit"
|
|
BeginProperty Font
|
|
Name = "MS Sans Serif"
|
|
Size = 9.75
|
|
Charset = 0
|
|
Weight = 700
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
Height = 615
|
|
Left = 6795
|
|
TabIndex = 4
|
|
TabStop = 0 'False
|
|
Top = 3765
|
|
Width = 1275
|
|
End
|
|
Begin VB.CommandButton cmdPrint
|
|
Caption = "&Print Report"
|
|
BeginProperty Font
|
|
Name = "MS Sans Serif"
|
|
Size = 9.75
|
|
Charset = 0
|
|
Weight = 700
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
Height = 615
|
|
Left = 6795
|
|
TabIndex = 3
|
|
TabStop = 0 'False
|
|
Top = 4485
|
|
Width = 1275
|
|
End
|
|
Begin VB.CommandButton cmdSave
|
|
Caption = "&Save Report"
|
|
BeginProperty Font
|
|
Name = "MS Sans Serif"
|
|
Size = 9.75
|
|
Charset = 0
|
|
Weight = 700
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
Height = 615
|
|
Left = 6795
|
|
TabIndex = 7
|
|
Top = 3045
|
|
Width = 1275
|
|
End
|
|
Begin VB.CommandButton cmdAdd
|
|
Caption = "&Add Report"
|
|
BeginProperty Font
|
|
Name = "MS Sans Serif"
|
|
Size = 9.75
|
|
Charset = 0
|
|
Weight = 700
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
Height = 615
|
|
Left = 5475
|
|
TabIndex = 2
|
|
Top = 3045
|
|
Width = 1275
|
|
End
|
|
Begin VB.ListBox lstReports
|
|
Height = 4545
|
|
Left = 60
|
|
Sorted = -1 'True
|
|
TabIndex = 0
|
|
Top = 300
|
|
Width = 5295
|
|
End
|
|
Begin VB.Label lblCopy
|
|
Alignment = 1 'Right Justify
|
|
AutoSize = -1 'True
|
|
Caption = "Copies:"
|
|
Height = 195
|
|
Left = 5475
|
|
TabIndex = 14
|
|
Top = 2745
|
|
Width = 525
|
|
End
|
|
Begin VB.Label lblDesc
|
|
Alignment = 1 'Right Justify
|
|
AutoSize = -1 'True
|
|
Caption = "Report Description:"
|
|
Height = 195
|
|
Left = 5400
|
|
TabIndex = 9
|
|
Top = 660
|
|
Width = 1365
|
|
End
|
|
Begin VB.Label lblFile
|
|
Alignment = 1 'Right Justify
|
|
AutoSize = -1 'True
|
|
Caption = "File Name:"
|
|
Height = 195
|
|
Left = 5400
|
|
TabIndex = 8
|
|
Top = 60
|
|
Width = 750
|
|
End
|
|
Begin VB.Label lblRepList
|
|
AutoSize = -1 'True
|
|
Caption = "Reports"
|
|
BeginProperty Font
|
|
Name = "MS Sans Serif"
|
|
Size = 9.75
|
|
Charset = 0
|
|
Weight = 700
|
|
Underline = 0 'False
|
|
Italic = 0 'False
|
|
Strikethrough = 0 'False
|
|
EndProperty
|
|
Height = 240
|
|
Left = 120
|
|
TabIndex = 1
|
|
Top = 0
|
|
Width = 840
|
|
End
|
|
End
|
|
Attribute VB_Name = "frmRepList"
|
|
Attribute VB_GlobalNameSpace = False
|
|
Attribute VB_Creatable = False
|
|
Attribute VB_PredeclaredId = True
|
|
Attribute VB_Exposed = False
|
|
Option Explicit
|
|
Dim moRSREPORT As Recordset
|
|
|
|
Dim mintREPORTID As Integer, mboolAdding As Boolean
|
|
Dim mintBOOKMARK As Integer, mintTYPE As Integer, mstrFILE As String
|
|
|
|
Private Sub optDest_Click(Index As Integer)
|
|
If optDest(0) Then
|
|
gintDEST = crptToWindow
|
|
End If
|
|
If optDest(1) Then
|
|
gintDEST = crptToPrinter
|
|
End If
|
|
If optDest(2) Then
|
|
gintDEST = crptToFile
|
|
mintTYPE = crptExcel50
|
|
' mstrFILE = "C:\123\CrewProj.XLS"
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub cmdAdd_Click()
|
|
mboolAdding = True
|
|
Call FormClear
|
|
cmdExit.Enabled = True
|
|
cmdSave.Enabled = True
|
|
cmdAdd.Enabled = False
|
|
lstReports.Enabled = False
|
|
|
|
End Sub
|
|
|
|
Private Sub cmdDelete_Click()
|
|
Dim strSQL As String, strYN As String
|
|
On Error GoTo Error_EH
|
|
strYN = MsgBox("Are You Sure You Want To Delete?", vbCritical + vbYesNo, "Delete?")
|
|
If strYN = vbNo Then
|
|
Exit Sub
|
|
End If
|
|
strSQL = "DELETE * FROM tblRepList WHERE Rep_id = " & lstReports.ItemData(lstReports.ListIndex)
|
|
goConn.Execute strSQL
|
|
Call ReportLoad
|
|
Exit Sub
|
|
|
|
Error_EH:
|
|
gstrMODULE = "Form RepList - Module cmdDelete"
|
|
Call ErrorHandler2
|
|
gstrMODULE = ""
|
|
Exit Sub
|
|
|
|
End Sub
|
|
|
|
Private Sub cmdExit_Click()
|
|
Unload Me
|
|
End Sub
|
|
|
|
Private Sub cmdPrint_Click()
|
|
Dim strSQL As String, strFile As String
|
|
|
|
On Error GoTo Error_EH
|
|
|
|
gintCOPY = Integer2Field(txtCopy)
|
|
|
|
strFile = "\" & Trim(moRSREPORT!FileName) & ".RPT"
|
|
crRepList.ReportFileName = App.Path & strFile
|
|
' crRepair.SelectionFormula = strSQL
|
|
' crRepair.Destination = crptToWindow
|
|
crRepList.CopiesToPrinter = gintCOPY
|
|
crRepList.Destination = gintDEST
|
|
If optDest(2) Then
|
|
crRepList.PrintFileType = crptExcel50
|
|
' crRepList.PrintFileName = mstrFILE
|
|
End If
|
|
crRepList.Action = 1
|
|
Exit Sub
|
|
|
|
Error_EH:
|
|
gstrMODULE = "Form RepList - Module cmdPrint_Click"
|
|
Call ErrorHandler2
|
|
gstrMODULE = ""
|
|
Exit Sub
|
|
|
|
End Sub
|
|
|
|
Private Sub cmdSave_Click()
|
|
|
|
mintBOOKMARK = lstReports.ListIndex
|
|
Call FormSave
|
|
lstReports.Enabled = True
|
|
cmdSave.Enabled = False
|
|
cmdAdd.Enabled = True
|
|
If mintBOOKMARK <> 0 Then
|
|
lstReports.ListIndex = mintBOOKMARK
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ReportLoad()
|
|
Dim oRS As Recordset
|
|
Dim strSQL As String
|
|
Dim strTYPE As String, strTYPE2 As String
|
|
Dim strLine As String
|
|
On Error GoTo Error_EH
|
|
|
|
strSQL = "SELECT * FROM tblRepList"
|
|
Set oRS = New Recordset
|
|
oRS.Open strSQL, goConn, adOpenForwardOnly, adLockReadOnly
|
|
lstReports.Clear
|
|
|
|
Do Until oRS.EOF
|
|
With lstReports
|
|
.AddItem Field2Str(oRS!rep_desc)
|
|
.ItemData(.NewIndex) = Field2Long(oRS!rep_id)
|
|
End With
|
|
|
|
oRS.MoveNext
|
|
Loop
|
|
oRS.Close
|
|
|
|
If lstReports.ListCount Then
|
|
lstReports.ListIndex = 0
|
|
mintREPORTID = lstReports.ItemData(lstReports.ListIndex)
|
|
Else
|
|
mintREPORTID = 0
|
|
End If
|
|
|
|
Exit Sub
|
|
|
|
Error_EH:
|
|
gstrMODULE = "Form RepList - Module ReportLoad"
|
|
Call ErrorHandler2
|
|
gstrMODULE = ""
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub cmdPrnSetup_Click()
|
|
CMDialog1.Flags = &H40
|
|
CMDialog1.Action = 5
|
|
End Sub
|
|
|
|
Private Sub Form_Activate()
|
|
|
|
'Set Default Copies
|
|
txtCopy = 1
|
|
gintCOPY = 1
|
|
gintDEST = 0
|
|
|
|
End Sub
|
|
|
|
Private Sub FieldsSave()
|
|
Dim strLOT As String
|
|
On Error GoTo Error_EH
|
|
|
|
If mboolAdding Then
|
|
moRSREPORT.AddNew
|
|
moRSREPORT!C_USER = gstrLOGIN
|
|
End If
|
|
|
|
|
|
With moRSREPORT
|
|
!U_USER = gstrLOGIN
|
|
!Update = Date
|
|
!FileName = Str2Field(txtFile)
|
|
!rep_desc = Str2Field(txtDesc)
|
|
End With
|
|
|
|
moRSREPORT.Update
|
|
|
|
If mboolAdding Then
|
|
Call ReportLoad
|
|
' Call PlanMatLoad
|
|
' Call POptLoad
|
|
If FormFind() Then
|
|
Call FormShow 'xxxxxxxxxxxxxxxxxx
|
|
Else
|
|
Call FormClear
|
|
End If
|
|
End If
|
|
|
|
Exit Sub
|
|
|
|
Error_EH:
|
|
gstrMODULE = "Form RepList - Module FieldsSave"
|
|
Call ErrorHandler2
|
|
gstrMODULE = ""
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub FormClear()
|
|
txtFile = ""
|
|
txtDesc = ""
|
|
|
|
End Sub
|
|
|
|
Private Sub FormSave()
|
|
Dim strName As String
|
|
|
|
On Error GoTo Error_EH
|
|
|
|
' Store the controls to the recordset
|
|
Call FieldsSave
|
|
|
|
moRSREPORT.Update
|
|
|
|
If mboolAdding Then
|
|
mboolAdding = False
|
|
End If
|
|
|
|
Call ReportLoad
|
|
|
|
Exit Sub
|
|
|
|
Error_EH:
|
|
gstrMODULE = "Form RepList - Module FormSave"
|
|
Call ErrorHandler2
|
|
gstrMODULE = ""
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
|
|
|
|
If moRSREPORT.State = adStateOpen Then
|
|
moRSREPORT.Close
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Function FormFind() As Boolean
|
|
Dim strSQL As String, strPlan As String, strMEMO As String
|
|
|
|
On Error GoTo Error_EH
|
|
|
|
strSQL = "SELECT * "
|
|
strSQL = strSQL & "FROM tblRepList "
|
|
strSQL = strSQL & "WHERE Rep_ID = " & mintREPORTID
|
|
|
|
Set moRSREPORT = New Recordset
|
|
|
|
moRSREPORT.Open strSQL, goConn, adOpenKeyset, adLockOptimistic
|
|
|
|
If moRSREPORT.EOF Then
|
|
FormFind = False
|
|
Else
|
|
FormFind = True
|
|
End If
|
|
Exit Function
|
|
|
|
Error_EH:
|
|
gstrMODULE = "Form RepList - Module FormFind"
|
|
Call ErrorHandler2
|
|
gstrMODULE = ""
|
|
Exit Function
|
|
End Function
|
|
|
|
Private Sub FormShow()
|
|
Dim strSQL As String
|
|
Dim oRS As Recordset
|
|
|
|
On Error GoTo Error_EH
|
|
|
|
With moRSREPORT
|
|
txtFile = Field2Str(!FileName)
|
|
txtDesc = Field2Str(!rep_desc)
|
|
End With
|
|
|
|
|
|
Exit Sub
|
|
|
|
Error_EH:
|
|
gstrMODULE = "Form RepList - Module FormShow"
|
|
Call ErrorHandler2
|
|
gstrMODULE = ""
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
|
|
|
|
If Shift = 4 Then
|
|
Exit Sub
|
|
End If
|
|
|
|
End Sub
|
|
Private Sub Form_KeyPress(KeyAscii As Integer)
|
|
If KeyAscii = 13 Then
|
|
SendKeys "{TAB}"
|
|
KeyAscii = 0
|
|
End If
|
|
|
|
End Sub
|
|
Private Sub Form_Load()
|
|
Dim strSQL As String
|
|
Dim oRS As Recordset
|
|
On Error GoTo Error_EH
|
|
|
|
Call ReportLoad
|
|
If FormFind() Then
|
|
Call FormShow
|
|
Else
|
|
Call FormClear
|
|
End If
|
|
Exit Sub
|
|
|
|
Error_EH:
|
|
gstrMODULE = "Form RepList - Module Form_Load"
|
|
Call ErrorHandler2
|
|
gstrMODULE = ""
|
|
Exit Sub
|
|
End Sub
|
|
|
|
Private Sub lstReports_Click()
|
|
On Error GoTo Error_EH
|
|
|
|
If lstReports.ListIndex <> -1 Then
|
|
mintREPORTID = lstReports.ItemData(lstReports.ListIndex)
|
|
If FormFind() Then
|
|
Call FormShow
|
|
Else
|
|
Call FormClear
|
|
End If
|
|
End If
|
|
Exit Sub
|
|
|
|
Error_EH:
|
|
gstrMODULE = "Form RepList - Module lstReports_Click"
|
|
Call ErrorHandler2
|
|
gstrMODULE = ""
|
|
Exit Sub
|
|
End Sub
|
|
|