VERSION 5.00
Begin VB.Form DC_Choice 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Form1"
   ClientHeight    =   1545
   ClientLeft      =   2265
   ClientTop       =   2745
   ClientWidth     =   4785
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   1545
   ScaleWidth      =   4785
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton SSC_dropped 
      Height          =   276
      Left            =   4320
      Style           =   1  'Graphical
      TabIndex        =   8
      Top             =   1080
      Width           =   252
   End
   Begin VB.TextBox txt_ShipDate 
      ForeColor       =   &H00000000&
      Height          =   288
      Left            =   3000
      Locked          =   -1  'True
      TabIndex        =   7
      Text            =   "txt_ShipDate"
      Top             =   1080
      Width           =   1212
   End
   Begin VB.PictureBox ButtonBox 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   238
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   612
      Left            =   0
      ScaleHeight     =   585
      ScaleWidth      =   4785
      TabIndex        =   1
      Top             =   0
      Width           =   4812
      Begin VB.PictureBox pic_FillGrid 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "DCCHOICE.frx":0000
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   238
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FFFFFF&
         Height          =   384
         Left            =   120
         ScaleHeight     =   390
         ScaleWidth      =   390
         TabIndex        =   9
         Top             =   65
         Width           =   384
      End
      Begin VB.PictureBox pic_quit 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "DCCHOICE.frx":030A
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   238
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FFFFFF&
         Height          =   384
         Left            =   3720
         ScaleHeight     =   390
         ScaleWidth      =   390
         TabIndex        =   3
         Top             =   65
         Width           =   384
      End
      Begin VB.PictureBox pic_help 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H00FFFFFF&
         BorderStyle     =   0  'None
         DragIcon        =   "DCCHOICE.frx":0614
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   238
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   384
         Left            =   4200
         ScaleHeight     =   390
         ScaleWidth      =   390
         TabIndex        =   2
         Top             =   65
         Width           =   384
      End
   End
   Begin VB.ComboBox cbo_ShipDC_code 
      Height          =   315
      ItemData        =   "DCCHOICE.frx":091E
      Left            =   1320
      List            =   "DCCHOICE.frx":0920
      Style           =   2  'Dropdown List
      TabIndex        =   4
      Top             =   1080
      Visible         =   0   'False
      Width           =   312
   End
   Begin VB.ComboBox cbo_ShipDC 
      Height          =   315
      ItemData        =   "DCCHOICE.frx":0922
      Left            =   240
      List            =   "DCCHOICE.frx":0924
      Style           =   2  'Dropdown List
      TabIndex        =   0
      Top             =   1080
      Width           =   1692
   End
   Begin VB.Label lbl_Ship_Date 
      Alignment       =   2  'Center
      Caption         =   "Shipping date"
      Height          =   252
      Left            =   3000
      TabIndex        =   6
      Top             =   720
      Width           =   1452
   End
   Begin VB.Label lbl_DC 
      Alignment       =   2  'Center
      Caption         =   "Shipping DC"
      Height          =   252
      Left            =   240
      TabIndex        =   5
      Top             =   720
      Width           =   1692
   End
End
Attribute VB_Name = "DC_Choice"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private mo_DC_Main As DC_Transaction_list

Private Sub Form_Load()

MouseOff

If gl_CodePage <> 1252 And gl_CodePage <> 0 Then ChangeCharset Me

pic_quit.Picture = LoadResPicture(RES_QUIT, 1)
pic_help.Picture = LoadResPicture(RES_HELP, 1)
pic_FillGrid.Picture = LoadResPicture(RES_FILLGRID, 1)
SSC_dropped.Picture = LoadResPicture(RES_DOWN2, vbResIcon)

FillCbo "DC_cbo", cbo_ShipDC_code, cbo_ShipDC
CboFindList
DC_choice_constants
txt_ShipDate = Format(Day(Date), "00") & "/" & Format(Month(Date), "00") & "/" & Format(Year(Date), "0000")
MouseOn

End Sub

Private Sub Form_Unload(Cancel As Integer)

If Not mo_DC_Main Is Nothing Then
    Call mo_DC_Main.Unload_A_COM
    Unload mo_DC_Main
    Set mo_DC_Main = Nothing
End If

End Sub

Private Sub pic_FillGrid_Click()

Dim li_Count As Integer

On Error GoTo ErrHandler

MouseOff
If Control Then
    gi_TranslateType = 1
    gi_GridWidth(0) = 1
    gi_GridWidth(1) = 1
    gi_GridWidth(2) = 1800
    gi_GridWidth(3) = 1800
    gi_GridWidth(4) = 1800
    gi_GridWidth(5) = 1800
    gi_GridWidth(6) = 1800
    For li_Count = 7 To 29
        gi_GridWidth(li_Count) = 1
    Next li_Count
    Select Case gs_TableName
    Case "DC_Int_End"
        
        Call Launch_DC_Main("EXEC DC_Interco_t_lst '" & cbo_ShipDC_code.List(cbo_ShipDC.ListIndex) & "', '" & FormatD(txt_ShipDate, "mm/dd/yyyy") & "', '" & gut_LangLogin.Code & "'", _
                            "", _
                            "EXEC DC_Transaction_lst '" & cbo_ShipDC_code.List(cbo_ShipDC.ListIndex) & "', 'I', '" & FormatD(txt_ShipDate, "mm/dd/yyyy") & "'", _
                            Array( _
                                 Join(Array("TRANS_Code", 0, 1, "TRANS_Code", "#TRANS_Code"), SEP) _
                                , Join(Array("iConcurrency", 0, 0, "iConcurrency", "#iConcurrency", "INT"), SEP) _
                                , Join(Array("DC_desc", 3100, 0, "DC_desc", "#ShipTo DC", "String"), SEP) _
                                , Join(Array("Delivery_Date", 1200, 0, "Delivery_Date", "#Delivery_Date", "DATE"), SEP) _
                                , Join(Array("Order_Number", 1300, 0, "Order_Number", "#Order_Number"), SEP) _
                                , Join(Array("CARRIER_Code", 1200, 0, "CARRIER_Code", "#CARRIER_Code", "String"), SEP) _
                                , Join(Array("CARRIER_Name", 2200, 0, "CARRIER_Name", "#CARRIER_Name"), SEP) _
                                , Join(Array("Cost_Comment", 2650, 0, "Cost_Comment", "#Comment"), SEP) _
                                , Join(Array("PrefLanguage", 0, 0, "PrefLanguage", "#PrefLanguage", "String"), SEP) _
                                ), _
                            "EXEC Screen_Csts 'main_DC_Interco', '" & gut_LangLogin.Code & "'", _
                            "EXEC Check_Security 'DC_Transaction', '" & prg.LoginName & "'", "DC_Int_End")
        
    Case "DC_Interco"
        Call Launch_DC_Main("EXEC DC_Interco_t_lst '" & cbo_ShipDC_code.List(cbo_ShipDC.ListIndex) & "', '" & FormatD(txt_ShipDate, "mm/dd/yyyy") & "', '" & gut_LangLogin.Code & "'", _
                            "", _
                            "EXEC DC_Transaction_lst '" & cbo_ShipDC_code.List(cbo_ShipDC.ListIndex) & "', 'I', '" & FormatD(txt_ShipDate, "mm/dd/yyyy") & "'", _
                            Array( _
                                 Join(Array("TRANS_Code", 0, 1, "TRANS_Code", "#TRANS_Code"), SEP) _
                                , Join(Array("iConcurrency", 0, 0, "iConcurrency", "#iConcurrency", "INT"), SEP) _
                                , Join(Array("DC_desc", 3100, 0, "DC_desc", "#ShipTo DC", "String"), SEP) _
                                , Join(Array("Delivery_Date", 1200, 0, "Delivery_Date", "#Delivery_Date", "DATE"), SEP) _
                                , Join(Array("Order_Number", 1300, 0, "Order_Number", "#Order_Number"), SEP) _
                                , Join(Array("CARRIER_Code", 1200, 0, "CARRIER_Code", "#CARRIER_Code", "String"), SEP) _
                                , Join(Array("CARRIER_Name", 2200, 0, "CARRIER_Name", "#CARRIER_Name"), SEP) _
                                , Join(Array("Cost_Comment", 2650, 0, "Cost_Comment", "#Comment"), SEP) _
                                , Join(Array("PrefLanguage", 0, 0, "PrefLanguage", "#PrefLanguage", "String"), SEP) _
                                ), _
                            "EXEC Screen_Csts 'main_DC_Interco', '" & gut_LangLogin.Code & "'", _
                            "EXEC Check_Security 'DC_Transaction', '" & prg.LoginName & "'", "DC_Interco")
    Case "DC_Customer"
        Call Launch_DC_Main("EXEC DC_Customer_t_lst '" & cbo_ShipDC_code.List(cbo_ShipDC.ListIndex) & "', '" & FormatD(txt_ShipDate, "mm/dd/yyyy") & "', '" & gut_LangLogin.Code & "'", _
                            "EXEC DC_Customer_t_lst2 $TRANS_Code$,'" & gut_LangLogin.Code & "'", _
                            "EXEC DC_Transaction_lst '" & cbo_ShipDC_code.List(cbo_ShipDC.ListIndex) & "', 'C', '" & FormatD(txt_ShipDate, "mm/dd/yyyy") & "'", _
                            Array( _
                                 Join(Array("TRANS_Code", 0, 1, "TRANS_Code", "#TRANS_Code"), SEP) _
                                , Join(Array("TRUCK_ID", 0, 0, "TRUCK_ID", "#TRUCK_ID", "String"), SEP) _
                                , Join(Array("MasterDetail", 250, 0, "MasterDetail", "", "BITMAP"), SEP), Join(Array("IsMaster", 0, 0, "IsMaster", "", "INT"), SEP), Join(Array("SubCount", 0, 0, "SubCount", "", "INT"), SEP) _
                                , Join(Array("iConcurrency", 0, 0, "iConcurrency", "#iConcurrency", "INT"), SEP) _
                                , Join(Array("Load_Planned_Starting_Time", 600, 0, "Load_Planned_Starting_Time", "#Time", "String"), SEP) _
                                , Join(Array("CUSTN1", 2400, 0, "CUSTN1", "#ShipToPartnerName", "String"), SEP) _
                                , Join(Array("Delivery_Date", 1000, 0, "Delivery_Date", "#Delivery_Date", "DATE"), SEP) _
                                , Join(Array("Ship_To_CT_Code", 450, 0, "Ship_To_CT_Code", "#Ship_To_CT_Code"), SEP) _
                                , Join(Array("Ship_To_Address", 3100, 0, "Ship_To_Address", "#Ship_To_Address"), SEP) _
                                , Join(Array("Quantity", 800, 0, "Quantity", "#Quantity"), SEP) _
                                , Join(Array("Delivery_Number", 1100, 0, "Delivery_Number", "#Delivery_Number"), SEP) _
                                , Join(Array("Shipment_Number", 1100, 0, "Shipment_Number", "#Shipment_Number"), SEP) _
                                , Join(Array("CARRIER_Code", 0, 0, "CARRIER_Code", "#CARRIER_Code", "String"), SEP) _
                                , Join(Array("CARRIER_Name", 2000, 0, "CARRIER_Name", "#CARRIER_Name"), SEP) _
                                , Join(Array("Remark", 2500, 0, "Remark", "#R/S Requirements"), SEP) _
                                , Join(Array("Cost_Comment", 850, 0, "Cost_Comment", "#Comment"), SEP) _
                                , Join(Array("PrefLanguage", 0, 0, "PrefLanguage", "#PrefLanguage", "String"), SEP) _
                                ), _
                            "EXEC Screen_Csts 'main_DC_Customer', '" & gut_LangLogin.Code & "'", _
                            "EXEC Check_Security 'DC_Transaction', '" & prg.LoginName & "'", "DC_Customer")
    Case "DC_Cust_End"
        Call Launch_DC_Main("EXEC DC_Customer_t_lst '" & cbo_ShipDC_code.List(cbo_ShipDC.ListIndex) & "', '" & FormatD(txt_ShipDate, "mm/dd/yyyy") & "', '" & gut_LangLogin.Code & "'", _
                            "EXEC DC_Customer_t_lst2 $TRANS_Code$,'" & gut_LangLogin.Code & "'", _
                            "EXEC DC_Transaction_lst '" & cbo_ShipDC_code.List(cbo_ShipDC.ListIndex) & "', 'C', '" & FormatD(txt_ShipDate, "mm/dd/yyyy") & "'", _
                            Array( _
                                 Join(Array("TRANS_Code", 0, 1, "TRANS_Code", "#TRANS_Code"), SEP) _
                                , Join(Array("TRUCK_ID", 0, 0, "TRUCK_ID", "#TRUCK_ID", "String"), SEP) _
                                , Join(Array("MasterDetail", 250, 0, "MasterDetail", "", "BITMAP"), SEP), Join(Array("IsMaster", 0, 0, "IsMaster", "", "INT"), SEP), Join(Array("SubCount", 0, 0, "SubCount", "", "INT"), SEP) _
                                , Join(Array("iConcurrency", 0, 0, "iConcurrency", "#iConcurrency", "INT"), SEP) _
                                , Join(Array("Load_Planned_Starting_Time", 600, 0, "Load_Planned_Starting_Time", "#Time", "String"), SEP) _
                                , Join(Array("CUSTN1", 2700, 0, "CUSTN1", "#ShipToPartnerName", "String"), SEP) _
                                , Join(Array("Delivery_Date", 1200, 0, "Delivery_Date", "#Delivery_Date", "DATE"), SEP) _
                                , Join(Array("Ship_To_CT_Code", 600, 0, "Ship_To_CT_Code", "#Ship_To_CT_Code"), SEP) _
                                , Join(Array("Ship_To_Address", 3300, 0, "Ship_To_Address", "#Ship_To_Address"), SEP) _
                                , Join(Array("Quantity", 1000, 0, "Quantity", "#Quantity"), SEP) _
                                , Join(Array("Delivery_Number", 1100, 0, "Delivery_Number", "#Delivery_Number"), SEP) _
                                , Join(Array("Shipment_Number", 1300, 0, "Shipment_Number", "#Shipment_Number"), SEP) _
                                , Join(Array("CARRIER_Code", 0, 0, "CARRIER_Code", "#CARRIER_Code", "String"), SEP) _
                                , Join(Array("CARRIER_Name", 2200, 0, "CARRIER_Name", "#CARRIER_Name"), SEP) _
                                , Join(Array("Remark", 2700, 0, "Remark", "#R/S Requirements"), SEP) _
                                , Join(Array("Cost_Comment", 0, 0, "Cost_Comment", "#Comment"), SEP) _
                                , Join(Array("PrefLanguage", 0, 0, "PrefLanguage", "#PrefLanguage", "String"), SEP) _
                                ), _
                            "EXEC Screen_Csts 'main_DC_Customer', '" & gut_LangLogin.Code & "'", _
                            "EXEC Check_Security 'DC_Transaction', '" & prg.LoginName & "'", "DC_Cust_End")
    Case "DC_Receipts"
        Call Launch_DC_Main("EXEC DC_Receipts_t_lst '" & cbo_ShipDC_code.List(cbo_ShipDC.ListIndex) & "', '" & FormatD(txt_ShipDate, "mm/dd/yyyy") & "', '" & gut_LangLogin.Code & "'", _
                            "", _
                            "EXEC DC_Transaction_lst '" & cbo_ShipDC_code.List(cbo_ShipDC.ListIndex) & "', 'R', '" & FormatD(txt_ShipDate, "mm/dd/yyyy") & "'", _
                            Array( _
                                 Join(Array("TRANS_Code", 0, 1, "TRANS_Code", "#TRANS_Code"), SEP) _
                                , Join(Array("iConcurrency", 0, 0, "iConcurrency", "#iConcurrency", "INT"), SEP) _
                                , Join(Array("Delivery_Date", 1200, 0, "Delivery_Date", "#Scheduled delivery date", "DATE"), SEP) _
                                , Join(Array("Supplier_Name", 3100, 0, "Supplier_Name", "#Supplier", "String"), SEP) _
                                , Join(Array("Order_Number", 1300, 0, "Order_Number", "#CLS order no", "String"), SEP) _
                                , Join(Array("CARRIER_Code", 0, 0, "CARRIER_Code", "#CARRIER_Code", "String"), SEP) _
                                , Join(Array("CARRIER_Name", 2200, 0, "CARRIER_Name", "#Carrier company", "String"), SEP) _
                                , Join(Array("Shipment_Number", 1300, 0, "Shipment_Number", "#CLS Shipment no", "String"), SEP) _
                                , Join(Array("TT_Code", 850, 0, "TT_Code", "#TT_Code", "String"), SEP) _
                                , Join(Array("remark", 2850, 0, "remark", "#R/S requirements", "String"), SEP) _
                                , Join(Array("Cost_Comment", 2150, 0, "Cost_Comment", "#Comment", "String"), SEP) _
                                , Join(Array("PrefLanguage", 0, 0, "PrefLanguage", "#PrefLanguage", "String"), SEP) _
                                ), _
                            "EXEC Screen_Csts 'main_DC_Receipts', '" & gut_LangLogin.Code & "'", _
                            "EXEC Check_Security 'DC_Transaction', '" & prg.LoginName & "'", "DC_Receipts")
    Case "DC_Rec_End"
        Call Launch_DC_Main("EXEC DC_Receipts_t_lst '" & cbo_ShipDC_code.List(cbo_ShipDC.ListIndex) & "', '" & FormatD(txt_ShipDate, "mm/dd/yyyy") & "', '" & gut_LangLogin.Code & "'", _
                            "", _
                            "EXEC DC_Transaction_lst '" & cbo_ShipDC_code.List(cbo_ShipDC.ListIndex) & "', 'R', '" & FormatD(txt_ShipDate, "mm/dd/yyyy") & "'", _
                            Array( _
                                 Join(Array("TRANS_Code", 0, 1, "TRANS_Code", "#TRANS_Code"), SEP) _
                                , Join(Array("iConcurrency", 0, 0, "iConcurrency", "#iConcurrency", "INT"), SEP) _
                                , Join(Array("Delivery_Date", 1200, 0, "Delivery_Date", "#Scheduled delivery date", "DATE"), SEP) _
                                , Join(Array("Supplier_Name", 3100, 0, "Supplier_Name", "#Supplier", "String"), SEP) _
                                , Join(Array("Order_Number", 1300, 0, "Order_Number", "#CLS order no", "String"), SEP) _
                                , Join(Array("CARRIER_Code", 0, 0, "CARRIER_Code", "#CARRIER_Code", "String"), SEP) _
                                , Join(Array("CARRIER_Name", 2200, 0, "CARRIER_Name", "#Carrier company", "String"), SEP) _
                                , Join(Array("Shipment_Number", 1300, 0, "Shipment_Number", "#CLS Shipment no", "String"), SEP) _
                                , Join(Array("TT_Code", 2650, 0, "TT_Code", "#TT_Code", "String"), SEP) _
                                , Join(Array("Cost_Comment", 2650, 0, "Cost_Comment", "#Comment", "String"), SEP) _
                                , Join(Array("PrefLanguage", 0, 0, "PrefLanguage", "#PrefLanguage", "String"), SEP) _
                                ), _
                            "EXEC Screen_Csts 'main_DC_Receipts', '" & gut_LangLogin.Code & "'", _
                            "EXEC Check_Security 'DC_Transaction', '" & prg.LoginName & "'", "DC_Rec_End")
        
    Case "DC_Containers", "DC_Cont_End"
        gs_ParamReq1 = "EXEC DC_Containers_t_lst '" & cbo_ShipDC_code.List(cbo_ShipDC.ListIndex) & "', '" & FormatD(txt_ShipDate, "mm/dd/yyyy") & "', '"
        gs_ParamReq2 = "EXEC Screen_Csts 'main_DC_Containers', '" & gut_LangLogin.Code & "'"
        gs_ParamReq3 = "EXEC Check_Security DC_Transaction, " & prg.LoginName
    End Select
    
    Select Case gs_TableName
        Case "DC_Customer", "DC_Interco", "DC_Cust_End", "DC_Int_End", "DC_Receipts", "DC_Rec_End"
        ' nothing to do
    
        Case Else
            Call C_main.show(vbModal, Me)
    End Select
    
End If
MouseOn

    Exit Sub
ErrHandler:
    Call MsgBox(Err.Description, vbCritical Or vbOKOnly, "ERROR")

End Sub

Private Sub pic_quit_Click()

Unload Me

End Sub


Private Sub SSC_dropped_Click()

On Error GoTo suite

MouseOff
gb_Return = KO
gs_Date = txt_ShipDate
Dates.show 1
If gb_Return Then
    txt_ShipDate = gs_Date
End If
MouseOn
Exit Sub

suite:
StdError
MouseOn

End Sub


Private Sub DC_choice_constants()

Dim ls_Field As String
Dim ls_Text As String
Dim ll_Statement As Long
Dim li_Status As Integer

On Error GoTo suite

If SQLSubmit(gl_Environment, gl_Database, ll_Statement, gs_ParamReq2) 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 = Left(ODBCData(ll_Statement, 2), 30)
        Select Case ls_Field
            Case "title": Caption = ls_Text
            Case "lbl_Ship_DC": lbl_DC = ls_Text
            Case "lbl_Ship_Date": lbl_Ship_Date = ls_Text
        End Select
    End If
Loop
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
Exit Sub

suite:
StdError
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
End Sub
Private Function Control() As Boolean

Control = KO
    
If cbo_ShipDC = "" Then
    If cbo_ShipDC.Enabled = OK Then
        cbo_ShipDC.SetFocus
    End If
    SendMessage 8, "Value must be filled in", gut_LangLogin.Code
    Exit Function
End If
If txt_ShipDate = "" Then
    SendMessage 8, "Value must be filled in", gut_LangLogin.Code
    txt_ShipDate.SetFocus
    Exit Function
End If
If Not IsDate(txt_ShipDate) Then
    SendMessage 101, "Wrong date format !", gut_LangLogin.Code
    txt_ShipDate.SetFocus
    Exit Function
End If

Control = OK

End Function


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

On Error GoTo suite

ls_req = "SELECT TOP 1 dc.DC_desc FROM Dist_Centre dc, security_identity si " _
         & "WHERE si.login_name = '" & prg.LoginName & "' " _
         & "AND si.company = dc.COMP_code " _
         & "AND dc.Language_code = 'E' AND dc.Drop_Flag <> 'X' " _
         & "ORDER BY dc.IsDefault DESC"

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
        DC_name = ODBCData(ll_Statement, 1)
    End If
Loop
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
cbo_ShipDC.ListIndex = ComboFindItem(cbo_ShipDC, DC_name)
Exit Sub

suite:
li_Status = SQLFreeStatement(ll_Statement, SQL_DROP)
StdError
End Sub

Private Function Launch_DC_Main(ByVal as_gridRequest As String, as_detailRequest As String, as_summaryRequest As String, ByVal av_gridColumns As Variant, ByVal as_screenConstatsRequest As String, ByVal as_securityRequest As String, ByVal as_tableName As String) As Boolean
    On Error GoTo onError
    
    If mo_DC_Main Is Nothing Then
    
        Set mo_DC_Main = New DC_Transaction_list
        
        Set mo_DC_Main.ArmDb = aDb
        mo_DC_Main.Language_Code = gut_LangLogin.Code
        mo_DC_Main.U_Code = prg.U_Code
        mo_DC_Main.LoginName = prg.LoginName
        
        Call mo_DC_Main.SetReconnectParams(prg.CurrentServerIP & prg.ServerInstance, prg.DBName, prg.LoginName, prg.U_PWD, prg.ApplicationName & prg.ApplicationVersion)
        
        Call mo_DC_Main.Load_A_COM
        If Not mo_DC_Main.Initialized Then
            Call ASC_SendMessage(aDb, prg.Session_language_Code, 8729, "You do not have rights to access this application. Please contact your IT support.")
            Call mo_DC_Main.Unload_A_COM
            Unload mo_DC_Main
            Set mo_DC_Main = Nothing
            Exit Function
        End If
    End If
    mo_DC_Main.DC_Code = cbo_ShipDC_code.List(DC_Choice.cbo_ShipDC.ListIndex)
    mo_DC_Main.DC_name = cbo_ShipDC.Text
    mo_DC_Main.ShippingDay = txt_ShipDate
    Call mo_DC_Main.GridRequests(as_gridRequest, as_detailRequest, as_summaryRequest)
    mo_DC_Main.GridColumns = av_gridColumns
    mo_DC_Main.ScreenConstantRequest = as_screenConstatsRequest
    mo_DC_Main.SecurityRequest = as_securityRequest
    mo_DC_Main.TableName = as_tableName
    
    Call mo_DC_Main.InitControl
    
    Call MouseOn
    
    Call mo_DC_Main.show(vbModal, Me)
    
    Launch_DC_Main = True
    Exit Function
onError:
    Launch_DC_Main = False
    MsgBox "Unable to launch DC_Main application: " & Err.Description
    If Not mo_DC_Main Is Nothing Then
        Call mo_DC_Main.Unload_A_COM
        Unload mo_DC_Main
        Set mo_DC_Main = Nothing
    End If
End Function


