home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 3_2004-2005.ISO / Data / Zips / Activity_L18345412302004.psc / frmDailyReport.frm < prev    next >
Text File  |  2004-10-19  |  9KB  |  305 lines

  1. VERSION 5.00
  2. Begin VB.Form frmDailyReport 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Daily Activity Reports"
  5.    ClientHeight    =   5085
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   4440
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MDIChild        =   -1  'True
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   5085
  14.    ScaleWidth      =   4440
  15.    Begin VB.CommandButton cmdGenerateReport 
  16.       Caption         =   "Generate Report"
  17.       Height          =   315
  18.       Left            =   60
  19.       TabIndex        =   11
  20.       Top             =   4740
  21.       Width           =   4275
  22.    End
  23.    Begin VB.Frame Frame2 
  24.       Caption         =   " Output "
  25.       Height          =   1635
  26.       Left            =   60
  27.       TabIndex        =   10
  28.       Top             =   3000
  29.       Width           =   4275
  30.       Begin VB.OptionButton optXMLFile 
  31.          Caption         =   "XML File"
  32.          Height          =   195
  33.          Left            =   180
  34.          TabIndex        =   15
  35.          Top             =   960
  36.          Width           =   3855
  37.       End
  38.       Begin VB.OptionButton optPrinter 
  39.          Caption         =   "Printer"
  40.          Height          =   195
  41.          Left            =   180
  42.          TabIndex        =   14
  43.          Top             =   1260
  44.          Width           =   3855
  45.       End
  46.       Begin VB.OptionButton optTextFile 
  47.          Caption         =   "Text File"
  48.          Height          =   195
  49.          Left            =   180
  50.          TabIndex        =   13
  51.          Top             =   660
  52.          Width           =   3855
  53.       End
  54.       Begin VB.OptionButton optScreen 
  55.          Caption         =   "Screen"
  56.          Height          =   195
  57.          Left            =   180
  58.          TabIndex        =   12
  59.          Top             =   360
  60.          Value           =   -1  'True
  61.          Width           =   3855
  62.       End
  63.    End
  64.    Begin VB.Frame Frame1 
  65.       Caption         =   " Daily Activity Report Parameters "
  66.       Height          =   2535
  67.       Left            =   60
  68.       TabIndex        =   0
  69.       Top             =   120
  70.       Width           =   4275
  71.       Begin VB.ComboBox cmbUserIDs 
  72.          Height          =   315
  73.          Left            =   60
  74.          TabIndex        =   16
  75.          Top             =   1680
  76.          Visible         =   0   'False
  77.          Width           =   555
  78.       End
  79.       Begin VB.CheckBox chkForAll 
  80.          Caption         =   "Generate report for all users"
  81.          Height          =   255
  82.          Left            =   240
  83.          TabIndex        =   9
  84.          Top             =   2160
  85.          Width           =   3855
  86.       End
  87.       Begin VB.ComboBox cmbUsers 
  88.          Height          =   315
  89.          Left            =   180
  90.          TabIndex        =   7
  91.          Top             =   1680
  92.          Width           =   3975
  93.       End
  94.       Begin VB.ComboBox cmbYear 
  95.          Enabled         =   0   'False
  96.          Height          =   315
  97.          Left            =   3240
  98.          TabIndex        =   6
  99.          Top             =   960
  100.          Width           =   915
  101.       End
  102.       Begin VB.ComboBox cmbMonth 
  103.          Enabled         =   0   'False
  104.          Height          =   315
  105.          Left            =   2460
  106.          TabIndex        =   5
  107.          Top             =   960
  108.          Width           =   735
  109.       End
  110.       Begin VB.ComboBox cmbDay 
  111.          Enabled         =   0   'False
  112.          Height          =   315
  113.          ItemData        =   "frmDailyReport.frx":0000
  114.          Left            =   1680
  115.          List            =   "frmDailyReport.frx":0002
  116.          TabIndex        =   4
  117.          Top             =   960
  118.          Width           =   735
  119.       End
  120.       Begin VB.OptionButton optSpecificDate 
  121.          Caption         =   "Specific Date"
  122.          Height          =   255
  123.          Left            =   180
  124.          TabIndex        =   3
  125.          Top             =   1020
  126.          Width           =   1935
  127.       End
  128.       Begin VB.OptionButton optYesterday 
  129.          Caption         =   "Yesterday"
  130.          Height          =   255
  131.          Left            =   180
  132.          TabIndex        =   2
  133.          Top             =   660
  134.          Width           =   1755
  135.       End
  136.       Begin VB.OptionButton optToday 
  137.          Caption         =   "Today"
  138.          Height          =   255
  139.          Left            =   180
  140.          TabIndex        =   1
  141.          Top             =   300
  142.          Value           =   -1  'True
  143.          Width           =   1755
  144.       End
  145.       Begin VB.Label Label1 
  146.          Caption         =   "Select user"
  147.          Height          =   255
  148.          Left            =   180
  149.          TabIndex        =   8
  150.          Top             =   1440
  151.          Width           =   2115
  152.       End
  153.    End
  154.    Begin VB.Label lblAlert 
  155.       BackColor       =   &H00C0FFC0&
  156.       Height          =   255
  157.       Left            =   60
  158.       TabIndex        =   17
  159.       Top             =   2700
  160.       Width           =   4275
  161.    End
  162. End
  163. Attribute VB_Name = "frmDailyReport"
  164. Attribute VB_GlobalNameSpace = False
  165. Attribute VB_Creatable = False
  166. Attribute VB_PredeclaredId = True
  167. Attribute VB_Exposed = False
  168. Option Explicit
  169.  
  170. Private rstUsers As New ADODB.Recordset
  171.  
  172. Private Sub chkForAll_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  173.     If chkForAll.Value = vbChecked Then
  174.         cmbUsers.Enabled = False
  175.     Else
  176.         cmbUsers.Enabled = True
  177.     End If
  178. End Sub
  179.  
  180. Private Sub cmdGenerateReport_Click()
  181.  
  182.     Dim dtmReportDate       As Date
  183.     Dim intReportUserID     As Long
  184.     Dim lngReportOutputType As ReportTypes
  185.     Dim rstReport           As New ADODB.Recordset
  186.     
  187.     lblAlert.Caption = ""
  188.     
  189.     If optToday Then
  190.         dtmReportDate = Now
  191.     ElseIf optYesterday Then
  192.         dtmReportDate = DateAdd("d", -1, Now)
  193.     Else
  194.         If Not IsDate(cmbYear & "-" & cmbMonth & "-" & cmbDay) Then
  195.             lblAlert.Caption = "Please specify a valid date"
  196.             Exit Sub
  197.         Else
  198.             dtmReportDate = CDate(cmbYear & "-" & cmbMonth & "-" & cmbDay)
  199.         End If
  200.     End If
  201.     
  202.     If chkForAll.Value = vbChecked Then
  203.         intReportUserID = 0
  204.     Else
  205.         If cmbUsers.ListIndex <= 0 Then
  206.             lblAlert.Caption = "Please select a user"
  207.             Exit Sub
  208.         Else
  209.             intReportUserID = cmbUserIDs.List(cmbUsers.ListIndex)
  210.         End If
  211.     End If
  212.  
  213.     If optScreen Then
  214.         lngReportOutputType = REPORT_TYPE_SCREEN
  215.     ElseIf optTextFile Then
  216.         lngReportOutputType = REPORT_TYPE_TEXT_FILE
  217.     ElseIf optXMLFile Then
  218.         lngReportOutputType = REPORT_TYPE_XML_FILE
  219.     ElseIf optPrinter Then
  220.         lngReportOutputType = REPORT_TYPE_PRINTER
  221.     End If
  222.     
  223.     'Call objData.GetActivityReports(rstReport, dtmReportDate, intReportUserID)
  224.     
  225.     If Not rstReport.EOF Then
  226.         Screen.MousePointer = vbHourglass
  227.         If CreatePrintReport(rstReport) Then
  228.             lblAlert.Caption = "Your report has been sent to printer"
  229.         Else
  230.             lblAlert.Caption = "Failed to create report"
  231.         End If
  232.         Screen.MousePointer = vbNormal
  233.         
  234.     End If
  235.     
  236. End Sub
  237.  
  238. Private Sub Form_Load()
  239.     Dim lngIdx As Long
  240.     
  241.     winOpen.blnDailyReports = True
  242.     
  243.     cmbDay.Clear
  244.     For lngIdx = 1 To 31
  245.         cmbDay.AddItem lngIdx
  246.     Next lngIdx
  247.     cmbDay.Text = Day(Now)
  248.     
  249.     cmbMonth.Clear
  250.     For lngIdx = 1 To 12
  251.         cmbMonth.AddItem lngIdx
  252.     Next lngIdx
  253.     cmbMonth.Text = Month(Now)
  254.     
  255.     cmbYear.Clear
  256.     For lngIdx = Year(Now) - 10 To Year(Now)
  257.         cmbYear.AddItem lngIdx
  258.     Next lngIdx
  259.     cmbYear.Text = Year(Now)
  260.     
  261.     Call objData.GetApplicationData(rstUsers, APP_DATA_TYPE_USERS)
  262.     
  263.     cmbUsers.Clear
  264.     cmbUserIDs.Clear
  265.     cmbUsers.AddItem "Please Select.."
  266.     cmbUserIDs.AddItem ""
  267.     
  268.     If rstUsers.RecordCount > 0 Then
  269.         Do While Not rstUsers.EOF
  270.             If rstUsers("bitUserIsActive") Then
  271.                 cmbUsers.AddItem rstUsers("strUserFirstName") & " " & rstUsers("strUserLastName")
  272.                 cmbUserIDs.AddItem rstUsers("intUserID")
  273.             End If
  274.             rstUsers.MoveNext
  275.         Loop
  276.     End If
  277.     
  278.     cmbUsers.Text = "Please Select.."
  279.    
  280. End Sub
  281.  
  282. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  283.     winOpen.blnDailyReports = False
  284. End Sub
  285.  
  286. Private Sub optSpecificDate_Click()
  287.     cmbDay.Enabled = True
  288.     cmbMonth.Enabled = True
  289.     cmbYear.Enabled = True
  290. End Sub
  291.  
  292. Private Sub optToday_Click()
  293.     cmbDay.Enabled = False
  294.     cmbMonth.Enabled = False
  295.     cmbYear.Enabled = False
  296. End Sub
  297.  
  298. Private Sub optYesterday_Click()
  299.     cmbDay.Enabled = False
  300.     cmbMonth.Enabled = False
  301.     cmbYear.Enabled = False
  302. End Sub
  303.  
  304.  
  305.