home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Inventory_20941312172007.psc / expirationAlert.frm < prev    next >
Text File  |  2007-12-17  |  9KB  |  257 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.Form expirationAlert 
  4.    BackColor       =   &H00FFFFFF&
  5.    BorderStyle     =   0  'None
  6.    Caption         =   "Expiration Alert"
  7.    ClientHeight    =   3375
  8.    ClientLeft      =   0
  9.    ClientTop       =   0
  10.    ClientWidth     =   6375
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    Picture         =   "expirationAlert.frx":0000
  15.    ScaleHeight     =   3375
  16.    ScaleWidth      =   6375
  17.    ShowInTaskbar   =   0   'False
  18.    StartUpPosition =   3  'Windows Default
  19.    Begin VB.CommandButton cmdStop 
  20.       Caption         =   "Stop Reminding"
  21.       BeginProperty Font 
  22.          Name            =   "Tahoma"
  23.          Size            =   8.25
  24.          Charset         =   0
  25.          Weight          =   400
  26.          Underline       =   0   'False
  27.          Italic          =   0   'False
  28.          Strikethrough   =   0   'False
  29.       EndProperty
  30.       Height          =   375
  31.       Left            =   4560
  32.       TabIndex        =   6
  33.       ToolTipText     =   "Stop showing this alert."
  34.       Top             =   2880
  35.       Width           =   1695
  36.    End
  37.    Begin VB.Timer Timer1 
  38.       Interval        =   10000
  39.       Left            =   5760
  40.       Top             =   240
  41.    End
  42.    Begin VB.CommandButton cmdRemindLater 
  43.       Caption         =   "Remind Me Later..."
  44.       BeginProperty Font 
  45.          Name            =   "Tahoma"
  46.          Size            =   8.25
  47.          Charset         =   0
  48.          Weight          =   400
  49.          Underline       =   0   'False
  50.          Italic          =   0   'False
  51.          Strikethrough   =   0   'False
  52.       EndProperty
  53.       Height          =   375
  54.       Left            =   2760
  55.       TabIndex        =   3
  56.       ToolTipText     =   "This action wil let the alert shows again in the future."
  57.       Top             =   2880
  58.       Width           =   1695
  59.    End
  60.    Begin VB.CommandButton cmdPurgeExpired 
  61.       Caption         =   "Remove All Expired Products"
  62.       BeginProperty Font 
  63.          Name            =   "Tahoma"
  64.          Size            =   8.25
  65.          Charset         =   0
  66.          Weight          =   400
  67.          Underline       =   0   'False
  68.          Italic          =   0   'False
  69.          Strikethrough   =   0   'False
  70.       EndProperty
  71.       Height          =   375
  72.       Left            =   240
  73.       TabIndex        =   2
  74.       ToolTipText     =   "This action will delete all expired products from the database."
  75.       Top             =   2880
  76.       Width           =   2415
  77.    End
  78.    Begin VB.PictureBox Picture5 
  79.       Appearance      =   0  'Flat
  80.       BackColor       =   &H80000005&
  81.       ForeColor       =   &H80000008&
  82.       Height          =   735
  83.       Left            =   120
  84.       Picture         =   "expirationAlert.frx":E44F2
  85.       ScaleHeight     =   705
  86.       ScaleWidth      =   6105
  87.       TabIndex        =   0
  88.       Top             =   120
  89.       Width           =   6135
  90.       Begin VB.Image Image1 
  91.          Height          =   480
  92.          Left            =   120
  93.          Picture         =   "expirationAlert.frx":E6898
  94.          Stretch         =   -1  'True
  95.          Top             =   120
  96.          Width           =   480
  97.       End
  98.       Begin VB.Label Label1 
  99.          AutoSize        =   -1  'True
  100.          BackStyle       =   0  'Transparent
  101.          Caption         =   "Expiration Alert"
  102.          BeginProperty Font 
  103.             Name            =   "Trebuchet MS"
  104.             Size            =   15.75
  105.             Charset         =   0
  106.             Weight          =   700
  107.             Underline       =   0   'False
  108.             Italic          =   0   'False
  109.             Strikethrough   =   0   'False
  110.          EndProperty
  111.          Height          =   405
  112.          Left            =   720
  113.          TabIndex        =   4
  114.          Top             =   120
  115.          Width           =   2310
  116.       End
  117.    End
  118.    Begin MSComctlLib.ListView expiredList 
  119.       Height          =   1335
  120.       Left            =   240
  121.       TabIndex        =   1
  122.       Top             =   1320
  123.       Width           =   6015
  124.       _ExtentX        =   10610
  125.       _ExtentY        =   2355
  126.       View            =   3
  127.       Arrange         =   2
  128.       LabelEdit       =   1
  129.       LabelWrap       =   -1  'True
  130.       HideSelection   =   0   'False
  131.       AllowReorder    =   -1  'True
  132.       FullRowSelect   =   -1  'True
  133.       GridLines       =   -1  'True
  134.       _Version        =   393217
  135.       ForeColor       =   -2147483640
  136.       BackColor       =   -2147483643
  137.       BorderStyle     =   1
  138.       Appearance      =   1
  139.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  140.          Name            =   "Tahoma"
  141.          Size            =   8.25
  142.          Charset         =   0
  143.          Weight          =   400
  144.          Underline       =   0   'False
  145.          Italic          =   0   'False
  146.          Strikethrough   =   0   'False
  147.       EndProperty
  148.       NumItems        =   0
  149.    End
  150.    Begin VB.Shape Shape1 
  151.       Height          =   3375
  152.       Left            =   0
  153.       Top             =   0
  154.       Width           =   6375
  155.    End
  156.    Begin VB.Label Label2 
  157.       AutoSize        =   -1  'True
  158.       BackStyle       =   0  'Transparent
  159.       Caption         =   "The following products will expire in few days:"
  160.       BeginProperty Font 
  161.          Name            =   "Tahoma"
  162.          Size            =   8.25
  163.          Charset         =   0
  164.          Weight          =   700
  165.          Underline       =   0   'False
  166.          Italic          =   0   'False
  167.          Strikethrough   =   0   'False
  168.       EndProperty
  169.       ForeColor       =   &H00404000&
  170.       Height          =   195
  171.       Left            =   240
  172.       TabIndex        =   5
  173.       Top             =   960
  174.       Width           =   3840
  175.    End
  176. End
  177. Attribute VB_Name = "expirationAlert"
  178. Attribute VB_GlobalNameSpace = False
  179. Attribute VB_Creatable = False
  180. Attribute VB_PredeclaredId = True
  181. Attribute VB_Exposed = False
  182. Private Sub cmdPurgeExpired_Click()
  183.     DB.Execute "DELETE FROM tblInventory WHERE expiration <= #" & Date & "#"
  184.     MsgBox "All expired stocks have been successfully removed from the database.", vbInformation, appTitle
  185.     Call Timer1_Timer
  186. End Sub
  187.  
  188. Private Sub cmdRemindLater_Click()
  189.     Me.Timer1.Enabled = True
  190.     Me.Hide
  191. End Sub
  192.  
  193. Private Sub cmdStop_Click()
  194.     Me.Hide
  195.     Me.Timer1.Enabled = False
  196. End Sub
  197.  
  198. Public Sub Timer1_Timer()
  199.     Dim RS2 As ADODB.Recordset
  200.     Set RS2 = New ADODB.Recordset
  201.     Dim item_ As ListItem
  202.     Dim i As Long
  203.     Dim flag1 As Integer
  204.     
  205.     'Clear Headers and Lists
  206.     Me.expiredList.ColumnHeaders.Clear
  207.     Me.expiredList.ListItems.Clear
  208.     
  209.     'Set Column Headers
  210.     With Me.expiredList.ColumnHeaders
  211.         .Add Text:="Product ID", Width:=1100
  212.         .Add Text:="Product Name", Width:=2500
  213.         .Add Text:="Expiration", Width:=3000
  214.     End With
  215.     
  216.     flag1 = 0
  217.     RS2.Open "SELECT * FROM tblInventory WHERE expiration <= #" & CDate(Date + DEFAULT_EXPIRATION_INTERVAL) & "#", DB, adOpenStatic, adLockOptimistic
  218.         If RS2.RecordCount > 0 Then flag1 = 1
  219.     RS2.Close
  220.     
  221.     If flag1 = 1 Then
  222.         RS2.Open "SELECT * FROM tblInventory WHERE expiration <= #" & CDate(Date + DEFAULT_EXPIRATION_INTERVAL) & "# ORDER BY expiration ASC", DB, adOpenStatic, adLockOptimistic
  223.             With RS2
  224.                 For i = 1 To .RecordCount Step 1
  225.                     Set item_ = Me.expiredList.ListItems.Add(Text:=!prodID)
  226.                     item_.SubItems(1) = getProdName(!prodID)
  227.                     
  228.                     If CDate(!expiration) > CDate(Date) Then
  229.                         item_.SubItems(2) = "Expiration is on " & !expiration
  230.                     End If
  231.     
  232.                     If CLng(CDate(!expiration) - Date) <= DEFAULT_EXPIRATION_INTERVAL Then
  233.                         item_.SubItems(2) = "Product will expire in " & CLng(CDate(!expiration) - Date) & " day(s)"
  234.                     End If
  235.                     
  236.                     If CDate(!expiration) <= Date Then
  237.                         item_.SubItems(2) = "Product is expired"
  238.                     End If
  239.                     .MoveNext
  240.                 Next i
  241.             End With
  242.         RS2.Close
  243.         Me.Left = (Screen.Width - Me.Width) - 100
  244.         Me.Top = (Screen.Height - Me.Height) - 450
  245.         If user.level = 1 Then
  246.             Me.cmdPurgeExpired.Enabled = True
  247.         Else
  248.             Me.cmdPurgeExpired.Enabled = False
  249.         End If
  250.         
  251.         Me.Show
  252.         Me.ZOrder vbBringToFront
  253.         Me.Timer1.Enabled = False
  254.         Me.expiredList.SetFocus
  255.     End If
  256. End Sub
  257.