VERSION 5.00
Begin VB.Form BI_Area 
   BorderStyle     =   1  'Fixed Single
   ClientHeight    =   7725
   ClientLeft      =   1290
   ClientTop       =   345
   ClientWidth     =   8625
   ClipControls    =   0   'False
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   7725
   ScaleWidth      =   8625
   ShowInTaskbar   =   0   'False
   Begin VB.TextBox txt_Desc 
      BackColor       =   &H00FFFFFF&
      Height          =   288
      Left            =   4140
      Locked          =   -1  'True
      TabIndex        =   9
      Top             =   120
      Width           =   4395
   End
   Begin VB.TextBox txt_SAP 
      BackColor       =   &H00FFFFFF&
      Height          =   288
      Left            =   1260
      Locked          =   -1  'True
      TabIndex        =   8
      Top             =   120
      Width           =   1512
   End
   Begin VB.TextBox txt_Possible 
      Height          =   6135
      Left            =   1110
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   7
      Top             =   1080
      Width           =   6015
   End
   Begin VB.PictureBox pic_pics 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ClipControls    =   0   'False
      ForeColor       =   &H80000008&
      Height          =   2460
      Left            =   7920
      ScaleHeight     =   2430
      ScaleWidth      =   630
      TabIndex        =   0
      Top             =   5220
      Width           =   665
      Begin VB.PictureBox pic_help 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "RECOM.frx":0000
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   60
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   4
         TabStop         =   0   'False
         Top             =   1800
         Width           =   480
      End
      Begin VB.PictureBox pic_refresh 
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         Height          =   480
         Left            =   60
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   3
         TabStop         =   0   'False
         Top             =   660
         Width           =   480
      End
      Begin VB.PictureBox pic_print 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   60
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   2
         TabStop         =   0   'False
         Top             =   60
         Visible         =   0   'False
         Width           =   480
      End
      Begin VB.PictureBox pic_quit 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "RECOM.frx":030A
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   480
         Left            =   60
         ScaleHeight     =   480
         ScaleWidth      =   480
         TabIndex        =   1
         TabStop         =   0   'False
         Top             =   1200
         Width           =   480
      End
   End
   Begin VB.Label lbl_Desc 
      Caption         =   "Description"
      Height          =   285
      Left            =   2880
      TabIndex        =   11
      Top             =   180
      Width           =   1215
   End
   Begin VB.Label lbl_SAP 
      Caption         =   "SAP code"
      Height          =   285
      Left            =   120
      TabIndex        =   10
      Top             =   180
      Width           =   1155
   End
   Begin VB.Label lbl_Possible 
      Alignment       =   2  'Center
      Height          =   255
      Left            =   3420
      TabIndex        =   6
      Top             =   720
      Visible         =   0   'False
      Width           =   3375
   End
   Begin VB.Label lbl_Recommended 
      Alignment       =   2  'Center
      Height          =   255
      Left            =   1320
      TabIndex        =   5
      Top             =   720
      Width           =   5595
   End
End
Attribute VB_Name = "BI_Area"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit


Private Sub GetPossible()
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ls_OldMarket As String
Dim ls_Market As String
Dim ls_Area As String
Dim i As Boolean

    On Error GoTo GetPossible_Err
    
    ls_req = "EXEC REA_products_possible_t_lst '" & gs_SAPCode & "','" & gut_LangLogin.Code & "'"
    
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
        li_Status = SQL_SUCCESS
    Else
        li_Status = SQL_ERROR
    End If
    ls_OldMarket = ""
    i = KO
    Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
        li_Status = SQLFetch(ll_Statement)
        If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
            ls_Market = ODBCData(ll_Statement, 1)
            ls_Area = ODBCData(ll_Statement, 2)
            If ls_Market <> ls_OldMarket Then
                If i Then
                    txt_Possible = txt_Possible & Chr(13) & Chr(10)
                End If
                txt_Possible = txt_Possible & ls_Market & Chr(13) & Chr(10)
                ls_OldMarket = ls_Market
                i = OK
            End If
            txt_Possible = txt_Possible & "      " & ls_Area & Chr(13) & Chr(10)
        End If
    Loop
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    Exit Sub
    
GetPossible_Err:
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    StdError
End Sub

Private Sub Form_Load()
    MouseOff
    
    If gl_CodePage <> 1252 And gl_CodePage <> 0 Then ChangeCharset Me

    Top = 1580 + frmMain.Top
    Left = 3280 + frmMain.Left
    Width = 8650
    Height = 7750
    
    pic_help.Picture = LoadResPicture(RES_HELP, 1)
    pic_Print.Picture = LoadResPicture(RES_PRINT, 1)
    pic_quit.Picture = LoadResPicture(RES_QUIT, 1)
    pic_refresh.Picture = LoadResPicture(RES_REFRESH, 1)
    GetScCsts
    FillGeneralInfo
    GetPossible
    MouseOn
End Sub

Private Sub GetScCsts()
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer
Dim ls_Field As String
Dim ls_Text As String

    On Error GoTo GetScCsts_Err
    
    ls_req = "EXEC Screen_Csts 'main_bi_area', '" & gut_LangLogin.Code & "'"
    
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
        li_Status = SQL_SUCCESS
    Else
        li_Status = SQL_ERROR
    End If
    Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
        li_Status = SQLFetch(ll_Statement)
        If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
            ls_Field = ODBCData(ll_Statement, 1)
            ls_Text = ODBCData(ll_Statement, 2)
            Select Case ls_Field
                Case "lbl_recom": lbl_Recommended = ls_Text
                Case "lbl_possible": lbl_Possible = ls_Text
                Case "lbl_SAP": lbl_SAP = ls_Text
                Case "lbl_desc": lbl_Desc = ls_Text
            End Select
        End If
    Loop
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    Exit Sub
    
GetScCsts_Err:
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    StdError
End Sub

Private Sub FillGeneralInfo()
Dim ls_req As String
Dim ll_Statement As Long
Dim li_Status As Integer

    On Error GoTo FillGeneralInfo_Err
    
    txt_SAP = gs_SAPCode
    ls_req = "EXEC Base_Item_Tech_t_sel '" & txt_SAP & "','" _
       & gut_LangWork.Code & "'"
    If SQLSubmit(gl_Environment, gl_Database, ll_Statement, ls_req) Then
        li_Status = SQL_SUCCESS
        Do While li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO
            li_Status = SQLFetch(ll_Statement)
            If li_Status = SQL_SUCCESS Or li_Status = SQL_SUCCESS_WITH_INFO Then
                txt_Desc.Text = ODBCData(ll_Statement, 1)
            End If
        Loop
    End If
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
    Exit Sub
    
FillGeneralInfo_Err:
    StdError
    li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
End Sub

Private Sub pic_help_Click()
    MouseOff
    gs_TableName = "Recommended_Area"
    frm_help.show 1
    MouseOn
End Sub

Private Sub pic_quit_Click()
    MouseOff
    Unload Me
    MouseOn
End Sub
