------------------------------------------------------------------------------
-- ADVANTAGE 2004.4.3
-- OPTIONS and APPLICATION SINCE ADVANTAGE 2004.4.2
-- 21/03/2009
------------------------------------------------------------------------------


----------------------------------------------------------------
-- New System Options
----------------------------------------------------------------

    IF NOT EXISTS
        (
            SELECT Sys_AW_Options_ID
            FROM Sys_AW_Options
            WHERE Control_Type = 'CheckBox' AND
                  Control_Name = 'chkAllowCreditBalanceCustomer' AND
                  Control_Index = 0
        )
        BEGIN
            INSERT Sys_AW_Options
                (
                    Control_Type,
                    Control_Name,
                    Control_Index,
                    Control_Value
                )
            VALUES
                (
                    'CheckBox',
                    'chkAllowCreditBalanceCustomer',
                    0,
                    '0'
                )
        END

----------------------------------------------------------------

    IF NOT EXISTS
        (
            SELECT Sys_AW_Options_ID
            FROM Sys_AW_Options
            WHERE Control_Type = 'CheckBox' AND
                  Control_Name = 'chkUseStockAdjGL' AND
                  Control_Index = 0
        )
        BEGIN
            INSERT Sys_AW_Options
                (
                    Control_Type,
                    Control_Name,
                    Control_Index,
                    Control_Value
                )
            VALUES
                (
                    'CheckBox',
                    'chkUseStockAdjGL',
                    0,
                    '0'
                )
        END

----------------------------------------------------------------

    IF NOT EXISTS
        (
            SELECT Sys_AW_Options_ID
            FROM Sys_AW_Options
            WHERE Control_Type = 'CheckBox' AND
                  Control_Name = 'chkPromotionEditing' AND
                  Control_Index = 0
        )
        BEGIN
            INSERT Sys_AW_Options
                (
                    Control_Type,
                    Control_Name,
                    Control_Index,
                    Control_Value
                )
            VALUES
                (
                    'CheckBox',
                    'chkPromotionEditing',
                    0,
                    '0'
                )
        END

----------------------------------------------------------------

    IF NOT EXISTS
        (
            SELECT Sys_AW_Options_ID
            FROM Sys_AW_Options
            WHERE Control_Type = 'CheckBox' AND
                  Control_Name = 'chkForceSelectSalesperson' AND
                  Control_Index = 0
        )
        BEGIN
            INSERT Sys_AW_Options
                (
                    Control_Type,
                    Control_Name,
                    Control_Index,
                    Control_Value
                )
            VALUES
                (
                    'CheckBox',
                    'chkForceSelectSalesperson',
                    0,
                    '0'
                )
        END

----------------------------------------------------------------

    IF NOT EXISTS
        (
            SELECT Sys_AW_Options_ID
            FROM Sys_AW_Options
            WHERE Control_Type = 'CheckBox' AND
                  Control_Name = 'chkSaveMenuJobcard' AND
                  Control_Index = 0
        )
        BEGIN
            INSERT Sys_AW_Options
                (
                    Control_Type,
                    Control_Name,
                    Control_Index,
                    Control_Value
                )
            VALUES
                (
                    'CheckBox',
                    'chkSaveMenuJobcard',
                    0,
                    '0'
                )
        END

----------------------------------------------------------------

    IF NOT EXISTS
        (
            SELECT Sys_AW_Options_ID
            FROM Sys_AW_Options
            WHERE Control_Type = 'CheckBox' AND
                  Control_Name = 'chkAllowDebitBalanceSupplier' AND
                  Control_Index = 0
        )
        BEGIN
            INSERT Sys_AW_Options
                (
                    Control_Type,
                    Control_Name,
                    Control_Index,
                    Control_Value
                )
            VALUES
                (
                    'CheckBox',
                    'chkAllowDebitBalanceSupplier',
                    0,
                    '0'
                )
        END

----------------------------------------------------------------
-- Retired System Options
----------------------------------------------------------------


----------------------------------------------------------------
-- New Applications
----------------------------------------------------------------

UPDATE Sys_AW_Applications
SET Slu_AW_Active_ID = 1
WHERE Description = 'Stock Take' AND
      Form_Name = 'frmStockTake'


------------------------------------

--------------------------------------------------


----------------------------------------------------------------------------
-- Retired Applications
----------------------------------------------------------------------------



------------------------------------

--------------------------------------------------

----------------------------------------------------------------------------
-- Lookup Editor
----------------------------------------------------------------------------

----------------------------------------------------------------
-- New Lookups
----------------------------------------------------------------

IF NOT EXISTS
    (
        SELECT Sys_AW_Lookup_Editor_ID
        FROM Sys_AW_Lookup_Editor
        WHERE TableName = 'Slu_AC_Statement_Messages' AND
              Caption = 'Statement Messages'
    )
    BEGIN
        INSERT Sys_AW_Lookup_Editor
            (
                Sys_AW_Lookup_Editor_ID,
                TableName,
                Caption,
                ColumnWidths
            )
            VALUES
            (
                80,
                'Slu_AC_Statement_Messages',
                'Statement Messages',
                '0,2400,10460,1005'
            )
    END
