VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.1#0"; "mscomctl.OCX"
Begin VB.UserControl DPC_ConfigSpc 
   ClientHeight    =   12315
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   18240
   ScaleHeight     =   12315
   ScaleWidth      =   18240
   Tag             =   "DPC_ConfigSpc"
   Begin VB.Frame fra_Detail 
      Height          =   1620
      Index           =   0
      Left            =   2805
      TabIndex        =   46
      Tag             =   "fra_Detail0"
      Top             =   4620
      Width           =   3435
      Begin VB.Frame fra_Bending 
         Caption         =   "#Bending"
         Height          =   1710
         Left            =   -15
         TabIndex        =   47
         Tag             =   "fra_Bending"
         Top             =   120
         Width           =   15135
         Begin VB.Frame fra_PanelSetupUNP 
            BorderStyle     =   0  'None
            Height          =   1350
            Left            =   12660
            TabIndex        =   341
            Tag             =   "fra_PanelSetupUNP"
            Top             =   195
            Width           =   2430
            Begin VB.CheckBox chk_Price 
               Caption         =   "#Change of width position"
               Height          =   435
               Index           =   12
               Left            =   30
               TabIndex        =   344
               Tag             =   "chk_PanelChangeBUNP"
               Top             =   975
               Width           =   2385
            End
            Begin VB.CheckBox chk_Price 
               Caption         =   "#Change of length position"
               Height          =   435
               Index           =   13
               Left            =   30
               TabIndex        =   343
               Tag             =   "chk_PanelChangeAUNP"
               Top             =   495
               Width           =   2355
            End
            Begin VB.CheckBox chk_Price 
               Caption         =   "#Setup charge per call"
               Height          =   435
               Index           =   14
               Left            =   30
               TabIndex        =   342
               Tag             =   "chk_PanelSetupChargeUNP"
               Top             =   30
               Width           =   2400
            End
         End
         Begin VB.Frame fra_PanelSetupPRF 
            BorderStyle     =   0  'None
            Height          =   1440
            Left            =   12660
            TabIndex        =   345
            Tag             =   "fra_PanelSetupPRF"
            Top             =   180
            Width           =   2430
            Begin VB.TextBox txt_Price 
               Alignment       =   1  'Right Justify
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   7
               Left            =   2760
               Locked          =   -1  'True
               TabIndex        =   354
               TabStop         =   0   'False
               Tag             =   "txt_PanelChangeBPRF_A"
               Top             =   675
               Visible         =   0   'False
               Width           =   720
            End
            Begin VB.TextBox txt_Price 
               Alignment       =   1  'Right Justify
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   6
               Left            =   2760
               Locked          =   -1  'True
               TabIndex        =   353
               TabStop         =   0   'False
               Tag             =   "txt_PanelChangeAPRF_A"
               Top             =   345
               Visible         =   0   'False
               Width           =   720
            End
            Begin VB.TextBox txt_Price 
               Alignment       =   1  'Right Justify
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   5
               Left            =   2760
               Locked          =   -1  'True
               TabIndex        =   352
               TabStop         =   0   'False
               Tag             =   "txt_PanelSetupChargePRF_A"
               Top             =   15
               Width           =   720
            End
            Begin VB.TextBox txt_Price 
               Alignment       =   1  'Right Justify
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   8
               Left            =   3585
               Locked          =   -1  'True
               TabIndex        =   351
               TabStop         =   0   'False
               Tag             =   "txt_PanelSetupChargePRF_M"
               Top             =   15
               Width           =   720
            End
            Begin VB.TextBox txt_Price 
               Alignment       =   1  'Right Justify
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   9
               Left            =   3585
               Locked          =   -1  'True
               TabIndex        =   350
               TabStop         =   0   'False
               Tag             =   "txt_PanelChangeAPRF_M"
               Top             =   345
               Visible         =   0   'False
               Width           =   720
            End
            Begin VB.TextBox txt_Price 
               Alignment       =   1  'Right Justify
               BackColor       =   &H8000000F&
               Height          =   330
               Index           =   10
               Left            =   3585
               Locked          =   -1  'True
               TabIndex        =   349
               TabStop         =   0   'False
               Tag             =   "txt_PanelChangeBPRF_M"
               Top             =   675
               Visible         =   0   'False
               Width           =   720
            End
            Begin VB.CheckBox chk_Price 
               Caption         =   "#Change of length position"
               Height          =   345
               Index           =   1
               Left            =   15
               TabIndex        =   347
               Tag             =   "chk_PanelChangeAPRF"
               Top             =   555
               Width           =   2400
            End
            Begin VB.CheckBox chk_Price 
               Caption         =   "#Change of width position"
               Height          =   345
               Index           =   2
               Left            =   15
               TabIndex        =   346
               Tag             =   "chk_PanelChangeBPRF"
               Top             =   1035
               Width           =   2400
            End
            Begin VB.CheckBox chk_Price 
               Caption         =   "#Setup charge per call"
               Height          =   345
               Index           =   0
               Left            =   15
               TabIndex        =   348
               Tag             =   "chk_PanelSetupChargePRF"
               Top             =   90
               Width           =   2400
            End
            Begin VB.Label lbl_Price 
               Alignment       =   2  'Center
               Caption         =   "#Curr"
               Height          =   240
               Index           =   5
               Left            =   4365
               TabIndex        =   357
               Tag             =   "_lbl_CURR_PanelSetupChargePrf"
               Top             =   45
               Width           =   435
            End
            Begin VB.Label lbl_Price 
               Alignment       =   2  'Center
               Caption         =   "#Curr"
               Height          =   240
               Index           =   6
               Left            =   4365
               TabIndex        =   356
               Tag             =   "_lbl_CURR_PanelChangeAPrf"
               Top             =   390
               Visible         =   0   'False
               Width           =   435
            End
            Begin VB.Label lbl_Price 
               Alignment       =   2  'Center
               Caption         =   "#Curr"
               Height          =   240
               Index           =   7
               Left            =   4365
               TabIndex        =   355
               Tag             =   "_lbl_CURR_PanelChangeBPrf"
               Top             =   735
               Visible         =   0   'False
               Width           =   435
            End
         End
         Begin VB.Frame fra_BendingSide 
            Caption         =   "#C"
            Height          =   1470
            Index           =   0
            Left            =   30
            TabIndex        =   48
            Tag             =   "fra_BendingC"
            Top             =   180
            Width           =   3525
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   105
               Left            =   2790
               MaxLength       =   7
               TabIndex        =   70
               Tag             =   "RPL_SXC"
               Top             =   195
               Width           =   675
            End
            Begin VB.CheckBox chk_RPL_CusDim 
               Caption         =   "#U/Z"
               Height          =   270
               Index           =   3
               Left            =   720
               TabIndex        =   340
               Tag             =   "lbl_BendingSizeUZA"
               Top             =   540
               Width           =   720
            End
            Begin VB.CheckBox chk_RPL_BVis 
               Caption         =   "#Visible"
               Height          =   285
               Index           =   0
               Left            =   1905
               TabIndex        =   98
               Tag             =   "chk_BendingSideVisibleC"
               Top             =   1155
               Width           =   1530
            End
            Begin VB.CheckBox chk_RPL_NClo 
               Caption         =   "#Notch closed"
               Height          =   285
               Index           =   0
               Left            =   75
               TabIndex        =   97
               Tag             =   "chk_BendingNotchClosedC"
               Top             =   1155
               Width           =   1785
            End
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   33
               Left            =   2775
               MaxLength       =   7
               TabIndex        =   69
               Tag             =   "RPL_SC"
               Top             =   795
               Width           =   675
            End
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   51
               Left            =   2100
               MaxLength       =   7
               TabIndex        =   68
               Tag             =   "RPL_UMaxC"
               Top             =   795
               Width           =   675
            End
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   52
               Left            =   1425
               MaxLength       =   7
               TabIndex        =   67
               Tag             =   "RPL_UMinC"
               Top             =   795
               Width           =   675
            End
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   32
               Left            =   750
               MaxLength       =   7
               TabIndex        =   66
               Tag             =   "RPL_UC"
               Top             =   795
               Width           =   675
            End
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   15
               Left            =   75
               MaxLength       =   7
               TabIndex        =   64
               Tag             =   "RPL_HC"
               Top             =   795
               Width           =   675
            End
            Begin Project1.ArmCombobox cbo_Bending 
               Height          =   345
               Index           =   0
               Left            =   90
               TabIndex        =   63
               Top             =   210
               Width           =   1320
               _ExtentX        =   2328
               _ExtentY        =   609
            End
            Begin VB.Label lbl_Label 
               Caption         =   "#SX"
               Height          =   255
               Index           =   127
               Left            =   2400
               TabIndex        =   415
               Tag             =   "lbl_BendingSizeSX"
               Top             =   240
               Width           =   360
            End
            Begin VB.Label lbl_Label 
               Caption         =   "#S"
               Height          =   255
               Index           =   52
               Left            =   2760
               TabIndex        =   61
               Tag             =   "lbl_BendingSizeSA"
               Top             =   570
               Width           =   645
            End
            Begin VB.Label lbl_Label 
               Caption         =   "#U/Z min/max"
               Height          =   255
               Index           =   26
               Left            =   1485
               TabIndex        =   57
               Tag             =   "lbl_BendingSizeUZMinA"
               Top             =   570
               Width           =   1380
            End
            Begin VB.Label lbl_Label 
               Caption         =   "#H"
               Height          =   255
               Index           =   50
               Left            =   90
               TabIndex        =   55
               Tag             =   "lbl_BendingSizeHA"
               Top             =   570
               Width           =   660
            End
         End
         Begin VB.Frame fra_BendingSide 
            Caption         =   "#D"
            Height          =   1470
            Index           =   1
            Left            =   3540
            TabIndex        =   49
            Tag             =   "fra_BendingD"
            Top             =   180
            Width           =   3525
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   106
               Left            =   2790
               MaxLength       =   7
               TabIndex        =   82
               Tag             =   "RPL_SXD"
               Top             =   195
               Width           =   675
            End
            Begin VB.CheckBox chk_RPL_BVis 
               Caption         =   "#Visible"
               Height          =   285
               Index           =   1
               Left            =   1860
               TabIndex        =   100
               Tag             =   "chk_BendingSideVisibleD"
               Top             =   1155
               Width           =   1530
            End
            Begin VB.CheckBox chk_RPL_NClo 
               Caption         =   "#Notch closed"
               Height          =   285
               Index           =   1
               Left            =   75
               TabIndex        =   99
               Tag             =   "chk_BendingNotchClosedD"
               Top             =   1155
               Width           =   1695
            End
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   20
               Left            =   2775
               MaxLength       =   7
               TabIndex        =   81
               Tag             =   "RPL_SD"
               Top             =   795
               Width           =   675
            End
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   19
               Left            =   2100
               MaxLength       =   7
               TabIndex        =   79
               Tag             =   "RPL_UMaxD"
               Top             =   795
               Width           =   675
            End
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   18
               Left            =   1425
               MaxLength       =   7
               TabIndex        =   78
               Tag             =   "RPL_UMinD"
               Top             =   795
               Width           =   675
            End
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   17
               Left            =   750
               MaxLength       =   7
               TabIndex        =   77
               Tag             =   "RPL_UD"
               Top             =   795
               Width           =   675
            End
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   16
               Left            =   75
               MaxLength       =   7
               TabIndex        =   75
               Tag             =   "RPL_HD"
               Top             =   795
               Width           =   675
            End
            Begin Project1.ArmCombobox cbo_Bending 
               Height          =   345
               Index           =   1
               Left            =   90
               TabIndex        =   74
               Top             =   210
               Width           =   1320
               _ExtentX        =   2328
               _ExtentY        =   609
            End
            Begin VB.Label lbl_Label 
               Caption         =   "#SX"
               Height          =   255
               Index           =   128
               Left            =   2385
               TabIndex        =   416
               Tag             =   "lbl_BendingSizeSX"
               Top             =   240
               Width           =   360
            End
            Begin VB.Label lbl_Label 
               Caption         =   "#U/Z"
               Height          =   300
               Index           =   15
               Left            =   735
               TabIndex        =   73
               Tag             =   "lbl_BendingSizeUZA"
               Top             =   570
               Width           =   675
            End
            Begin VB.Label lbl_Label 
               Caption         =   "#S"
               Height          =   255
               Index           =   13
               Left            =   2805
               TabIndex        =   72
               Tag             =   "lbl_BendingSizeSA"
               Top             =   570
               Width           =   645
            End
            Begin VB.Label lbl_Label 
               Caption         =   "#U/Z min/max"
               Height          =   255
               Index           =   12
               Left            =   1425
               TabIndex        =   71
               Tag             =   "lbl_BendingSizeUZMinA"
               Top             =   555
               Width           =   1380
            End
            Begin VB.Label lbl_Label 
               Caption         =   "#H"
               Height          =   255
               Index           =   11
               Left            =   75
               TabIndex        =   65
               Tag             =   "lbl_BendingSizeHA"
               Top             =   570
               Width           =   660
            End
         End
         Begin VB.Frame fra_BendingSide 
            Caption         =   "#E"
            Height          =   1470
            Index           =   2
            Left            =   7050
            TabIndex        =   51
            Tag             =   "fra_BendingE"
            Top             =   180
            Width           =   2820
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   107
               Left            =   2070
               MaxLength       =   7
               TabIndex        =   89
               Tag             =   "RPL_SXE"
               Top             =   210
               Width           =   675
            End
            Begin VB.CheckBox chk_RPL_BVis 
               Caption         =   "#Visible"
               Height          =   285
               Index           =   2
               Left            =   1740
               TabIndex        =   102
               Tag             =   "chk_BendingSideVisibleE"
               Top             =   1140
               Width           =   1035
            End
            Begin VB.CheckBox chk_RPL_NClo 
               Caption         =   "#Notch closed"
               Height          =   315
               Index           =   2
               Left            =   75
               TabIndex        =   101
               Tag             =   "chk_BendingNotchClosedE"
               Top             =   1125
               Width           =   1695
            End
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   25
               Left            =   1515
               MaxLength       =   7
               TabIndex        =   88
               Tag             =   "RPL_SE"
               Top             =   795
               Width           =   675
            End
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   22
               Left            =   795
               MaxLength       =   7
               TabIndex        =   87
               Tag             =   "RPL_UE"
               Top             =   795
               Width           =   675
            End
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   21
               Left            =   75
               MaxLength       =   7
               TabIndex        =   85
               Tag             =   "RPL_HE"
               Top             =   795
               Width           =   675
            End
            Begin Project1.ArmCombobox cbo_Bending 
               Height          =   345
               Index           =   2
               Left            =   90
               TabIndex        =   84
               Top             =   210
               Width           =   1320
               _ExtentX        =   2328
               _ExtentY        =   609
            End
            Begin VB.Label lbl_Label 
               Caption         =   "#SX"
               Height          =   255
               Index           =   129
               Left            =   1695
               TabIndex        =   417
               Tag             =   "lbl_BendingSizeSX"
               Top             =   240
               Width           =   360
            End
            Begin VB.Label lbl_Label 
               Caption         =   "#U/Z"
               Height          =   300
               Index           =   20
               Left            =   780
               TabIndex        =   83
               Tag             =   "lbl_BendingSizeUZA"
               Top             =   570
               Width           =   675
            End
            Begin VB.Label lbl_Label 
               Caption         =   "#S"
               Height          =   255
               Index           =   19
               Left            =   1515
               TabIndex        =   80
               Tag             =   "lbl_BendingSizeSA"
               Top             =   570
               Width           =   645
            End
            Begin VB.Label lbl_Label 
               Caption         =   "#H"
               Height          =   255
               Index           =   17
               Left            =   75
               TabIndex        =   76
               Tag             =   "lbl_BendingSizeHA"
               Top             =   570
               Width           =   660
            End
         End
         Begin VB.Frame fra_BendingSide 
            Caption         =   "#F"
            Height          =   1470
            Index           =   3
            Left            =   9855
            TabIndex        =   52
            Tag             =   "fra_BendingF"
            Top             =   180
            Width           =   2805
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   108
               Left            =   2055
               MaxLength       =   7
               TabIndex        =   96
               Tag             =   "RPL_SXF"
               Top             =   195
               Width           =   675
            End
            Begin VB.CheckBox chk_RPL_BVis 
               Caption         =   "#Visible"
               Height          =   285
               Index           =   3
               Left            =   1740
               TabIndex        =   104
               Tag             =   "chk_BendingSideVisibleF"
               Top             =   1140
               Width           =   1035
            End
            Begin VB.CheckBox chk_RPL_NClo 
               Caption         =   "#Notch closed"
               Height          =   315
               Index           =   3
               Left            =   75
               TabIndex        =   103
               Tag             =   "chk_BendingNotchClosedF"
               Top             =   1125
               Width           =   1695
            End
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   26
               Left            =   1515
               MaxLength       =   7
               TabIndex        =   95
               Tag             =   "RPL_SF"
               Top             =   795
               Width           =   675
            End
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   24
               Left            =   795
               MaxLength       =   7
               TabIndex        =   94
               Tag             =   "RPL_UF"
               Top             =   795
               Width           =   675
            End
            Begin VB.TextBox txt_Textbox 
               Height          =   345
               Index           =   23
               Left            =   75
               MaxLength       =   7
               TabIndex        =   93
               Tag             =   "RPL_HF"
               Top             =   795
               Width           =   675
            End
            Begin Project1.ArmCombobox cbo_Bending 
               Height          =   345
               Index           =   3
               Left            =   90
               TabIndex        =   92
               Top             =   210
               Width           =   1320
               _ExtentX        =   2328
               _ExtentY        =   609
            End
            Begin VB.Label lbl_Label 
               Caption         =   "#SX"
               Height          =   255
               Index           =   130
               Left            =   1680
               TabIndex        =   418
               Tag             =   "lbl_BendingSizeSX"
               Top             =   240
               Width           =   360
            End
            Begin VB.Label lbl_Label 
               Caption         =   "#U/Z"
               Height          =   300
               Index           =   22
               Left            =   780
               TabIndex        =   91
               Tag             =   "lbl_BendingSizeUZA"
               Top             =   570
               Width           =   675
            End
            Begin VB.Label lbl_Label 
               Caption         =   "#S"
               Height          =   255
               Index           =   21
               Left            =   1515
               TabIndex        =   90
               Tag             =   "lbl_BendingSizeSA"
               Top             =   570
               Width           =   645
            End
            Begin VB.Label lbl_Label 
               Caption         =   "#H"
               Height          =   255
               Index           =   18
               Left            =   75
               TabIndex        =   86
               Tag             =   "lbl_BendingSizeHA"
               Top             =   570
               Width           =   660
            End
         End
      End
      Begin VB.Frame fra_Inlay 
         Caption         =   "#Inlay"
         Height          =   1665
         Left            =   0
         TabIndex        =   60
         Tag             =   "fra_Inlay"
         Top             =   5835
         Width           =   11550
         Begin VB.TextBox txt_Textbox 
            Height          =   360
            Index           =   78
            Left            =   1890
            TabIndex        =   188
            Tag             =   "INL_Name3"
            Top             =   1245
            Width           =   3645
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   360
            Index           =   77
            Left            =   1890
            TabIndex        =   181
            Tag             =   "INL_Name2"
            Top             =   885
            Width           =   3645
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   360
            Index           =   76
            Left            =   1890
            TabIndex        =   174
            Tag             =   "INL_Name1"
            Top             =   525
            Width           =   3645
         End
         Begin VB.CheckBox chk_InlaySetupCharge 
            Caption         =   "#Setup charge per call"
            Height          =   270
            Index           =   0
            Left            =   9120
            TabIndex        =   178
            Tag             =   "chk_InlaySetupCharge"
            Top             =   525
            Width           =   2355
         End
         Begin VB.CheckBox chk_InlaySetupCharge 
            Caption         =   "#Setup charge per call"
            Height          =   270
            Index           =   1
            Left            =   9120
            TabIndex        =   185
            Tag             =   "chk_InlaySetupCharge"
            Top             =   915
            Width           =   2355
         End
         Begin VB.CheckBox chk_InlaySetupCharge 
            Caption         =   "#Setup charge per call"
            Height          =   270
            Index           =   2
            Left            =   9120
            TabIndex        =   192
            Tag             =   "chk_InlaySetupCharge"
            Top             =   1275
            Width           =   2355
         End
         Begin VB.CommandButton cmd_Inlay 
            Caption         =   "..."
            Height          =   330
            Index           =   2
            Left            =   1470
            TabIndex        =   187
            Tag             =   "cmd_Inlay2"
            Top             =   1260
            Width           =   390
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   48
            Left            =   60
            MaxLength       =   80
            TabIndex        =   186
            Tag             =   "INL_Code3"
            Top             =   1275
            Width           =   1410
         End
         Begin VB.CommandButton cmd_Inlay 
            Caption         =   "..."
            Height          =   330
            Index           =   1
            Left            =   1470
            TabIndex        =   180
            Tag             =   "cmd_Inlay1"
            Top             =   900
            Width           =   390
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   47
            Left            =   60
            MaxLength       =   80
            TabIndex        =   179
            Tag             =   "INL_Code2"
            Top             =   900
            Width           =   1410
         End
         Begin VB.CommandButton cmd_Inlay 
            Caption         =   "..."
            Height          =   330
            Index           =   0
            Left            =   1470
            TabIndex        =   173
            Tag             =   "cmd_Inlay0"
            Top             =   540
            Width           =   390
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   46
            Left            =   60
            MaxLength       =   80
            TabIndex        =   172
            Tag             =   "INL_Code1"
            Top             =   540
            Width           =   1410
         End
         Begin Project1.ArmCombobox cbo_InlayName 
            Height          =   345
            Index           =   0
            Left            =   1890
            TabIndex        =   175
            Tag             =   "INL_Name1"
            Top             =   525
            Width           =   3660
            _ExtentX        =   6456
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_InlayDelivery 
            Height          =   345
            Index           =   0
            Left            =   5565
            TabIndex        =   176
            Top             =   540
            Width           =   1755
            _ExtentX        =   3096
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_InlayPurchase 
            Height          =   345
            Index           =   0
            Left            =   7335
            TabIndex        =   177
            Top             =   540
            Width           =   1755
            _ExtentX        =   3096
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_InlayName 
            Height          =   345
            Index           =   1
            Left            =   1890
            TabIndex        =   182
            Tag             =   "INL_Name2"
            Top             =   900
            Width           =   3660
            _ExtentX        =   6456
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_InlayDelivery 
            Height          =   345
            Index           =   1
            Left            =   5565
            TabIndex        =   183
            Top             =   900
            Width           =   1755
            _ExtentX        =   3096
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_InlayPurchase 
            Height          =   345
            Index           =   1
            Left            =   7335
            TabIndex        =   184
            Top             =   900
            Width           =   1755
            _ExtentX        =   3096
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_InlayName 
            Height          =   345
            Index           =   2
            Left            =   1890
            TabIndex        =   189
            Tag             =   "INL_Name3"
            Top             =   1260
            Width           =   3660
            _ExtentX        =   6456
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_InlayDelivery 
            Height          =   345
            Index           =   2
            Left            =   5565
            TabIndex        =   190
            Top             =   1260
            Width           =   1755
            _ExtentX        =   3096
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_InlayPurchase 
            Height          =   345
            Index           =   2
            Left            =   7335
            TabIndex        =   191
            Top             =   1260
            Width           =   1755
            _ExtentX        =   3096
            _ExtentY        =   609
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Purchase"
            Height          =   255
            Index           =   49
            Left            =   7335
            TabIndex        =   295
            Tag             =   "lbl_PanelCode"
            Top             =   285
            Width           =   1530
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Delivery"
            Height          =   255
            Index           =   48
            Left            =   5580
            TabIndex        =   294
            Tag             =   "lbl_PanelCode"
            Top             =   285
            Width           =   1530
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Name"
            Height          =   255
            Index           =   47
            Left            =   1845
            TabIndex        =   293
            Tag             =   "lbl_INL_Name"
            Top             =   285
            Width           =   1530
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Code"
            Height          =   255
            Index           =   46
            Left            =   195
            TabIndex        =   292
            Tag             =   "lbl_PanelCode"
            Top             =   285
            Width           =   1530
         End
      End
      Begin VB.Frame fra_Gasket 
         Caption         =   "#Gasket/Spacer"
         Height          =   1080
         Left            =   0
         TabIndex        =   59
         Tag             =   "fra_Gasket"
         Top             =   4740
         Width           =   15120
         Begin Project1.ArmCombobox cbo_GSK 
            Height          =   345
            Index           =   0
            Left            =   765
            TabIndex        =   157
            Top             =   255
            Width           =   2865
            _ExtentX        =   5054
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_GSK 
            Height          =   345
            Index           =   1
            Left            =   4440
            TabIndex        =   159
            Top             =   255
            Width           =   2865
            _ExtentX        =   5054
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_GSK 
            Height          =   345
            Index           =   2
            Left            =   8130
            TabIndex        =   161
            Top             =   255
            Width           =   2865
            _ExtentX        =   5054
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_GSK 
            Height          =   345
            Index           =   3
            Left            =   11805
            TabIndex        =   163
            Top             =   255
            Width           =   2865
            _ExtentX        =   5054
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_GSK2 
            Height          =   345
            Index           =   0
            Left            =   765
            TabIndex        =   165
            Top             =   600
            Width           =   2865
            _ExtentX        =   5054
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_GSK2 
            Height          =   345
            Index           =   1
            Left            =   4440
            TabIndex        =   167
            Top             =   600
            Width           =   2865
            _ExtentX        =   5054
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_GSK2 
            Height          =   345
            Index           =   2
            Left            =   8130
            TabIndex        =   169
            Top             =   600
            Width           =   2865
            _ExtentX        =   5054
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_GSK2 
            Height          =   345
            Index           =   3
            Left            =   11805
            TabIndex        =   171
            Top             =   600
            Width           =   2865
            _ExtentX        =   5054
            _ExtentY        =   609
         End
         Begin VB.CheckBox chk_Gasket2 
            Caption         =   "#F"
            Height          =   300
            Index           =   3
            Left            =   11205
            TabIndex        =   170
            Tag             =   "chk_Gasket2F"
            Top             =   630
            Width           =   705
         End
         Begin VB.CheckBox chk_Gasket2 
            Caption         =   "#E"
            Height          =   300
            Index           =   2
            Left            =   7530
            TabIndex        =   168
            Tag             =   "chk_Gasket2E"
            Top             =   630
            Width           =   705
         End
         Begin VB.CheckBox chk_Gasket2 
            Caption         =   "#D"
            Height          =   300
            Index           =   1
            Left            =   3870
            TabIndex        =   166
            Tag             =   "chk_Gasket2D"
            Top             =   630
            Width           =   705
         End
         Begin VB.CheckBox chk_Gasket2 
            Caption         =   "#C"
            Height          =   300
            Index           =   0
            Left            =   195
            TabIndex        =   164
            Tag             =   "chk_Gasket2C"
            Top             =   630
            Width           =   705
         End
         Begin VB.CheckBox chk_Gasket 
            Caption         =   "#F"
            Height          =   300
            Index           =   3
            Left            =   11205
            TabIndex        =   162
            Tag             =   "chk_GasketF"
            Top             =   285
            Width           =   705
         End
         Begin VB.CheckBox chk_Gasket 
            Caption         =   "#E"
            Height          =   300
            Index           =   2
            Left            =   7530
            TabIndex        =   160
            Tag             =   "chk_GasketE"
            Top             =   285
            Width           =   705
         End
         Begin VB.CheckBox chk_Gasket 
            Caption         =   "#D"
            Height          =   300
            Index           =   1
            Left            =   3870
            TabIndex        =   158
            Tag             =   "chk_GasketD"
            Top             =   285
            Width           =   705
         End
         Begin VB.CheckBox chk_Gasket 
            Caption         =   "#C"
            Height          =   300
            Index           =   0
            Left            =   195
            TabIndex        =   156
            Tag             =   "chk_GasketC"
            Top             =   285
            Width           =   705
         End
      End
      Begin VB.Frame fra_Packing 
         Caption         =   "#Packing"
         Height          =   1665
         Left            =   11610
         TabIndex        =   62
         Tag             =   "fra_Packing"
         Top             =   5835
         Width           =   3510
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   49
            Left            =   2295
            TabIndex        =   194
            Tag             =   "RPL_PU"
            Top             =   630
            Width           =   1110
         End
         Begin Project1.ArmCombobox cbo_Packing 
            Height          =   345
            Left            =   180
            TabIndex        =   193
            Top             =   255
            Width           =   3225
            _ExtentX        =   5689
            _ExtentY        =   609
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Packing qty"
            Height          =   255
            Index           =   45
            Left            =   195
            TabIndex        =   216
            Tag             =   "lbl_RPL_PU"
            Top             =   675
            Width           =   1725
         End
      End
      Begin VB.Frame fra_Perforation 
         Caption         =   "#Perforation"
         Height          =   1590
         Left            =   0
         TabIndex        =   54
         Tag             =   "fra_Perforation"
         Top             =   1815
         Width           =   7530
         Begin VB.CheckBox chk_CorrectStep 
            Caption         =   "#Correct"
            Height          =   312
            Left            =   6465
            TabIndex        =   122
            TabStop         =   0   'False
            Tag             =   "chk_PerfCorrectedSetp"
            Top             =   525
            Width           =   990
         End
         Begin VB.CheckBox chk_StandardPerf 
            Caption         =   "#Std"
            Height          =   312
            Left            =   6465
            TabIndex        =   121
            TabStop         =   0   'False
            Tag             =   "chk_PerfStandardValues"
            Top             =   210
            Width           =   780
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   60
            Left            =   5055
            TabIndex        =   119
            Tag             =   "RPL_UBoWF"
            Text            =   "0"
            Top             =   1170
            Width           =   650
         End
         Begin VB.CheckBox chk_PerfBorder 
            Caption         =   "#F over border"
            Height          =   270
            Index           =   3
            Left            =   3645
            TabIndex        =   118
            Tag             =   "chk_PerfBorderF"
            Top             =   1230
            Width           =   1545
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   56
            Left            =   5745
            TabIndex        =   120
            Tag             =   "RPL_UBorF"
            Text            =   "0"
            Top             =   1170
            Width           =   650
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   59
            Left            =   5055
            TabIndex        =   116
            Tag             =   "RPL_UBoWE"
            Text            =   "0"
            Top             =   840
            Width           =   650
         End
         Begin VB.CheckBox chk_PerfBorder 
            Caption         =   "#E over border"
            Height          =   270
            Index           =   2
            Left            =   3645
            TabIndex        =   115
            Tag             =   "chk_PerfBorderE"
            Top             =   885
            Width           =   1545
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   55
            Left            =   5745
            TabIndex        =   117
            Tag             =   "RPL_UBorE"
            Text            =   "0"
            Top             =   855
            Width           =   650
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   58
            Left            =   5055
            TabIndex        =   113
            Tag             =   "RPL_UBoWD"
            Text            =   "0"
            Top             =   510
            Width           =   650
         End
         Begin VB.CheckBox chk_PerfBorder 
            Caption         =   "#D over border"
            Height          =   270
            Index           =   1
            Left            =   3645
            TabIndex        =   112
            Tag             =   "chk_PerfBorderD"
            Top             =   540
            Width           =   1545
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   54
            Left            =   5745
            TabIndex        =   114
            Tag             =   "RPL_UBorD"
            Text            =   "0"
            Top             =   525
            Width           =   650
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   57
            Left            =   5055
            TabIndex        =   110
            Tag             =   "RPL_UBoWC"
            Text            =   "0"
            Top             =   195
            Width           =   650
         End
         Begin VB.CheckBox chk_PerfBorder 
            Caption         =   "#C over border"
            Height          =   270
            Index           =   0
            Left            =   3645
            TabIndex        =   109
            Tag             =   "chk_PerfBorderC"
            Top             =   180
            Width           =   1545
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   61
            Left            =   5745
            TabIndex        =   111
            Tag             =   "RPL_UBorC"
            Text            =   "0"
            Top             =   195
            Width           =   650
         End
         Begin VB.OptionButton opt_UnperfBorder 
            Caption         =   "#Standard unperofated border (8 - 12 mm)"
            Height          =   240
            Index           =   0
            Left            =   150
            TabIndex        =   106
            Tag             =   "opt_UnperfBorderStd"
            Top             =   690
            Width           =   3480
         End
         Begin VB.OptionButton opt_UnperfBorder 
            Caption         =   "#Overperforated border"
            Height          =   240
            Index           =   1
            Left            =   150
            TabIndex        =   107
            Tag             =   "opt_UnperfBorderOver"
            Top             =   975
            Width           =   3480
         End
         Begin VB.OptionButton opt_UnperfBorder 
            Caption         =   "#Other"
            Height          =   240
            Index           =   2
            Left            =   150
            TabIndex        =   108
            Tag             =   "opt_UnperfBorderOther"
            Top             =   1260
            Width           =   3480
         End
         Begin Project1.ArmCombobox cbo_Perforation 
            Height          =   345
            Left            =   195
            TabIndex        =   105
            Top             =   270
            Width           =   3225
            _ExtentX        =   5689
            _ExtentY        =   609
         End
      End
      Begin VB.Frame fra_Coating 
         Caption         =   "#Coating"
         Height          =   1590
         Left            =   7575
         TabIndex        =   56
         Tag             =   "fra_Coating"
         Top             =   1815
         Width           =   7545
         Begin VB.TextBox txt_Textbox 
            Height          =   360
            Index           =   75
            Left            =   2085
            TabIndex        =   125
            Tag             =   "COA_Name"
            Top             =   210
            Width           =   5415
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   990
            Index           =   74
            Left            =   3015
            MaxLength       =   80
            TabIndex        =   131
            Tag             =   "COA_Desc"
            Top             =   555
            Width           =   4485
         End
         Begin VB.CommandButton cmd_Coating 
            Caption         =   "..."
            Height          =   330
            Left            =   1695
            TabIndex        =   124
            TabStop         =   0   'False
            Tag             =   "cmd_Coating"
            Top             =   210
            Width           =   390
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   330
            Index           =   28
            Left            =   45
            MaxLength       =   80
            TabIndex        =   123
            Tag             =   "COA_Code"
            Top             =   210
            Width           =   1650
         End
         Begin Project1.ArmCombobox cbo_Coating 
            Height          =   345
            Left            =   2085
            TabIndex        =   126
            Tag             =   "COA_Name"
            Top             =   210
            Width           =   5415
            _ExtentX        =   9551
            _ExtentY        =   609
         End
         Begin VB.Frame fra_CoatingSide 
            Height          =   1065
            Left            =   45
            TabIndex        =   127
            Tag             =   "fra_CoatingSide"
            Top             =   480
            Width           =   2970
            Begin VB.OptionButton opt_CoatingSide 
               Caption         =   "#Corrosive protection, backside full coverage"
               Height          =   375
               Index           =   2
               Left            =   45
               TabIndex        =   130
               Tag             =   "opt_CoatingSideFull"
               Top             =   660
               Width           =   2880
            End
            Begin VB.OptionButton opt_CoatingSide 
               Caption         =   "#Both side coated"
               Height          =   330
               Index           =   1
               Left            =   45
               TabIndex        =   129
               Tag             =   "opt_CoatingSideBoth"
               Top             =   360
               Width           =   2880
            End
            Begin VB.OptionButton opt_CoatingSide 
               Caption         =   "#One side coated"
               Height          =   330
               Index           =   0
               Left            =   45
               TabIndex        =   128
               Tag             =   "opt_CoatingSideOne"
               Top             =   105
               Width           =   2880
            End
         End
      End
      Begin VB.Frame fra_Cutout 
         Caption         =   "#Cutout"
         Height          =   1335
         Left            =   30
         TabIndex        =   58
         Tag             =   "fra_Cutout"
         Top             =   3405
         Width           =   15105
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   45
            Left            =   10860
            TabIndex        =   153
            TabStop         =   0   'False
            Tag             =   "PCT_SizeK4"
            Text            =   "0"
            Top             =   885
            Width           =   960
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   44
            Left            =   12420
            TabIndex        =   154
            TabStop         =   0   'False
            Tag             =   "PCT_SizeL4"
            Text            =   "0"
            Top             =   510
            Width           =   960
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   43
            Left            =   12420
            TabIndex        =   155
            TabStop         =   0   'False
            Tag             =   "PCT_SizeM4"
            Text            =   "0"
            Top             =   870
            Width           =   960
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   42
            Left            =   10860
            TabIndex        =   152
            TabStop         =   0   'False
            Tag             =   "PCT_SizeDJ4"
            Text            =   "0"
            Top             =   540
            Width           =   960
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   41
            Left            =   7530
            TabIndex        =   147
            TabStop         =   0   'False
            Tag             =   "PCT_SizeK3"
            Text            =   "0"
            Top             =   885
            Width           =   960
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   40
            Left            =   9090
            TabIndex        =   148
            TabStop         =   0   'False
            Tag             =   "PCT_SizeL3"
            Text            =   "0"
            Top             =   525
            Width           =   960
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   39
            Left            =   9090
            TabIndex        =   149
            TabStop         =   0   'False
            Tag             =   "PCT_SizeM3"
            Text            =   "0"
            Top             =   885
            Width           =   960
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   38
            Left            =   7530
            TabIndex        =   146
            TabStop         =   0   'False
            Tag             =   "PCT_SizeDJ3"
            Text            =   "0"
            Top             =   540
            Width           =   960
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   37
            Left            =   4200
            TabIndex        =   141
            TabStop         =   0   'False
            Tag             =   "PCT_SizeK2"
            Text            =   "0"
            Top             =   885
            Width           =   960
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   36
            Left            =   5760
            TabIndex        =   142
            TabStop         =   0   'False
            Tag             =   "PCT_SizeL2"
            Text            =   "0"
            Top             =   525
            Width           =   960
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   35
            Left            =   5760
            TabIndex        =   143
            TabStop         =   0   'False
            Tag             =   "PCT_SizeM2"
            Text            =   "0"
            Top             =   885
            Width           =   960
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   34
            Left            =   4200
            TabIndex        =   140
            TabStop         =   0   'False
            Tag             =   "PCT_SizeDJ2"
            Text            =   "0"
            Top             =   540
            Width           =   960
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   31
            Left            =   870
            TabIndex        =   135
            TabStop         =   0   'False
            Tag             =   "PCT_SizeK1"
            Text            =   "0"
            Top             =   900
            Width           =   960
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   30
            Left            =   2430
            TabIndex        =   136
            TabStop         =   0   'False
            Tag             =   "PCT_SizeL1"
            Text            =   "0"
            Top             =   540
            Width           =   960
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   29
            Left            =   2430
            TabIndex        =   137
            TabStop         =   0   'False
            Tag             =   "PCT_SizeM1"
            Text            =   "0"
            Top             =   900
            Width           =   960
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   27
            Left            =   870
            TabIndex        =   134
            TabStop         =   0   'False
            Tag             =   "PCT_SizeDJ1"
            Text            =   "0"
            Top             =   555
            Width           =   960
         End
         Begin Project1.ArmCombobox cbo_Cutout 
            Height          =   345
            Index           =   0
            Left            =   870
            TabIndex        =   132
            Top             =   195
            Width           =   960
            _ExtentX        =   1693
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Cutout 
            Height          =   345
            Index           =   1
            Left            =   4200
            TabIndex        =   138
            Top             =   180
            Width           =   960
            _ExtentX        =   1693
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Cutout 
            Height          =   345
            Index           =   2
            Left            =   7530
            TabIndex        =   144
            Top             =   180
            Width           =   960
            _ExtentX        =   1693
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_Cutout 
            Height          =   345
            Index           =   3
            Left            =   10860
            TabIndex        =   150
            Top             =   180
            Width           =   960
            _ExtentX        =   1693
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_CutPerf 
            Height          =   345
            Index           =   0
            Left            =   1950
            TabIndex        =   133
            Top             =   195
            Width           =   1440
            _ExtentX        =   2540
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_CutPerf 
            Height          =   345
            Index           =   1
            Left            =   5280
            TabIndex        =   139
            Top             =   195
            Width           =   1440
            _ExtentX        =   2540
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_CutPerf 
            Height          =   345
            Index           =   2
            Left            =   8610
            TabIndex        =   145
            Top             =   195
            Width           =   1440
            _ExtentX        =   2540
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_CutPerf 
            Height          =   345
            Index           =   3
            Left            =   11940
            TabIndex        =   151
            Top             =   195
            Width           =   1440
            _ExtentX        =   2540
            _ExtentY        =   609
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Type 4"
            Height          =   255
            Index           =   44
            Left            =   10050
            TabIndex        =   215
            Tag             =   "lbl_CutoutType"
            Top             =   255
            Width           =   825
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#K"
            Height          =   255
            Index           =   43
            Left            =   10050
            TabIndex        =   214
            Tag             =   "lbl_CutoutSizeK"
            Top             =   930
            Width           =   780
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#L"
            Height          =   255
            Index           =   42
            Left            =   11850
            TabIndex        =   213
            Tag             =   "lbl_CutoutSizeL"
            Top             =   585
            Width           =   555
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#M"
            Height          =   255
            Index           =   41
            Left            =   11850
            TabIndex        =   212
            Tag             =   "lbl_CutoutSizeM"
            Top             =   930
            Width           =   645
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#J/d"
            Height          =   255
            Index           =   40
            Left            =   10050
            TabIndex        =   211
            Tag             =   "lbl_CutoutSizeD"
            Top             =   600
            Width           =   765
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Type 3"
            Height          =   255
            Index           =   39
            Left            =   6735
            TabIndex        =   210
            Tag             =   "lbl_CutoutType"
            Top             =   255
            Width           =   780
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#K"
            Height          =   255
            Index           =   38
            Left            =   6735
            TabIndex        =   209
            Tag             =   "lbl_CutoutSizeK"
            Top             =   930
            Width           =   780
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#L"
            Height          =   255
            Index           =   37
            Left            =   8520
            TabIndex        =   208
            Tag             =   "lbl_CutoutSizeL"
            Top             =   585
            Width           =   555
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#M"
            Height          =   255
            Index           =   36
            Left            =   8520
            TabIndex        =   207
            Tag             =   "lbl_CutoutSizeM"
            Top             =   930
            Width           =   645
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#J/d"
            Height          =   255
            Index           =   33
            Left            =   6735
            TabIndex        =   206
            Tag             =   "lbl_CutoutSizeD"
            Top             =   600
            Width           =   765
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Type 2"
            Height          =   255
            Index           =   30
            Left            =   3435
            TabIndex        =   205
            Tag             =   "lbl_CutoutType"
            Top             =   255
            Width           =   810
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#K"
            Height          =   255
            Index           =   32
            Left            =   3435
            TabIndex        =   204
            Tag             =   "lbl_CutoutSizeK"
            Top             =   930
            Width           =   780
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#L"
            Height          =   255
            Index           =   29
            Left            =   5190
            TabIndex        =   203
            Tag             =   "lbl_CutoutSizeL"
            Top             =   585
            Width           =   555
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#M"
            Height          =   255
            Index           =   28
            Left            =   5190
            TabIndex        =   202
            Tag             =   "lbl_CutoutSizeM"
            Top             =   930
            Width           =   645
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#J/d"
            Height          =   255
            Index           =   27
            Left            =   3435
            TabIndex        =   201
            Tag             =   "lbl_CutoutSizeD"
            Top             =   600
            Width           =   765
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Type 1"
            Height          =   255
            Index           =   24
            Left            =   90
            TabIndex        =   200
            Tag             =   "lbl_CutoutType"
            Top             =   270
            Width           =   780
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#K"
            Height          =   255
            Index           =   31
            Left            =   90
            TabIndex        =   199
            Tag             =   "lbl_CutoutSizeK"
            Top             =   945
            Width           =   780
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#L"
            Height          =   255
            Index           =   34
            Left            =   1860
            TabIndex        =   198
            Tag             =   "lbl_CutoutSizeL"
            Top             =   600
            Width           =   555
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#M"
            Height          =   255
            Index           =   35
            Left            =   1860
            TabIndex        =   197
            Tag             =   "lbl_CutoutSizeM"
            Top             =   945
            Width           =   645
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#J/d"
            Height          =   255
            Index           =   25
            Left            =   90
            TabIndex        =   196
            Tag             =   "lbl_CutoutSizeD"
            Top             =   615
            Width           =   765
         End
      End
   End
   Begin VB.Frame fra_Detail 
      Caption         =   "#Attributes"
      Height          =   1125
      Index           =   7
      Left            =   10695
      TabIndex        =   287
      Tag             =   "fra_PanelAttrib"
      Top             =   3105
      Width           =   1710
      Begin VB.Frame fra_Attrib 
         Height          =   2055
         Left            =   210
         TabIndex        =   311
         Tag             =   "fra_Attrib"
         Top             =   240
         Width           =   15195
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   99
            Left            =   13260
            TabIndex        =   404
            Tag             =   "MAT_CustTariff"
            Top             =   1650
            Width           =   1785
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   73
            Left            =   13260
            TabIndex        =   327
            Tag             =   "CLS_Name8"
            Top             =   1290
            Width           =   1785
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   72
            Left            =   13260
            TabIndex        =   326
            Tag             =   "CLS_Name7"
            Top             =   930
            Width           =   1785
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   71
            Left            =   13260
            TabIndex        =   325
            Tag             =   "CLS_Name6"
            Top             =   570
            Width           =   1785
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   70
            Left            =   13260
            TabIndex        =   324
            Tag             =   "CLS_Name5"
            Top             =   210
            Width           =   1785
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   69
            Left            =   9600
            TabIndex        =   323
            Tag             =   "CLS_Name4"
            Top             =   1290
            Width           =   1785
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   68
            Left            =   9600
            TabIndex        =   322
            Tag             =   "CLS_Name3"
            Top             =   930
            Width           =   1785
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   67
            Left            =   9600
            TabIndex        =   321
            Tag             =   "CLS_Name2"
            Top             =   570
            Width           =   1785
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   66
            Left            =   9600
            TabIndex        =   320
            Tag             =   "CLS_Name1"
            Top             =   210
            Width           =   1785
         End
         Begin Project1.ArmCombobox cbo_RPL_PGroup 
            Height          =   345
            Left            =   1425
            TabIndex        =   316
            Top             =   210
            Width           =   5940
            _ExtentX        =   10478
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_RPL_AGroup 
            Height          =   345
            Left            =   1425
            TabIndex        =   317
            Top             =   570
            Width           =   5940
            _ExtentX        =   10478
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_RPL_MGroup 
            Height          =   345
            Left            =   1425
            TabIndex        =   318
            Top             =   930
            Width           =   5940
            _ExtentX        =   10478
            _ExtentY        =   609
         End
         Begin Project1.ArmCombobox cbo_RPL_OGroup 
            Height          =   345
            Left            =   1425
            TabIndex        =   319
            Top             =   1290
            Width           =   5940
            _ExtentX        =   10478
            _ExtentY        =   609
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Custom tariff"
            Height          =   225
            Index           =   121
            Left            =   11445
            TabIndex        =   405
            Tag             =   "lbl_MAT_CustTariff"
            Top             =   1725
            Width           =   1890
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Sound absorption"
            Height          =   225
            Index           =   103
            Left            =   11460
            TabIndex        =   335
            Tag             =   "lbl_CLS_Name5"
            Top             =   255
            Width           =   1890
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Thermal conductivity"
            Height          =   225
            Index           =   102
            Left            =   11460
            TabIndex        =   334
            Tag             =   "lbl_CLS_Name6"
            Top             =   630
            Width           =   1890
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Durability"
            Height          =   225
            Index           =   101
            Left            =   11460
            TabIndex        =   333
            Tag             =   "lbl_CLS_Name7"
            Top             =   990
            Width           =   1890
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Emission"
            Height          =   225
            Index           =   100
            Left            =   11460
            TabIndex        =   332
            Tag             =   "lbl_CLS_Name8"
            Top             =   1365
            Width           =   1890
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#CE Number"
            Height          =   225
            Index           =   99
            Left            =   7410
            TabIndex        =   331
            Tag             =   "lbl_CLS_Name1"
            Top             =   225
            Width           =   2235
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Certificate number"
            Height          =   225
            Index           =   98
            Left            =   7410
            TabIndex        =   330
            Tag             =   "lbl_CLS_Name2"
            Top             =   600
            Width           =   2235
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Product type"
            Height          =   225
            Index           =   97
            Left            =   7410
            TabIndex        =   329
            Tag             =   "lbl_CLS_Name3"
            Top             =   960
            Width           =   2235
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Declaration of performance"
            Height          =   225
            Index           =   96
            Left            =   7410
            TabIndex        =   328
            Tag             =   "lbl_CLS_Name4"
            Top             =   1335
            Width           =   2235
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Object group"
            Height          =   225
            Index           =   95
            Left            =   90
            TabIndex        =   315
            Tag             =   "lbl_RPL_OGroup"
            Top             =   1365
            Width           =   1365
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Goods group"
            Height          =   225
            Index           =   94
            Left            =   90
            TabIndex        =   314
            Tag             =   "lbl_RPL_MGroup"
            Top             =   990
            Width           =   1365
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Article group"
            Height          =   225
            Index           =   93
            Left            =   90
            TabIndex        =   313
            Tag             =   "lbl_RPL_AGroup"
            Top             =   630
            Width           =   1365
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Product group"
            Height          =   225
            Index           =   92
            Left            =   90
            TabIndex        =   312
            Tag             =   "lbl_RPL_PGroup"
            Top             =   255
            Width           =   1365
         End
      End
      Begin Project1.ArmGrid grd_Attrib 
         Height          =   7065
         Left            =   180
         TabIndex        =   288
         Tag             =   "grd_Attrib"
         Top             =   2340
         Width           =   14880
         _ExtentX        =   26247
         _ExtentY        =   12462
      End
   End
   Begin VB.Frame fra_Detail 
      Caption         =   "#Packing"
      Height          =   1260
      Index           =   3
      Left            =   375
      TabIndex        =   291
      Tag             =   "fra_PanelPacking"
      Top             =   3900
      Width           =   1650
      Begin VB.Frame fra_StockDetail 
         Caption         =   "#Stock"
         Height          =   2565
         Left            =   60
         TabIndex        =   406
         Top             =   3120
         Width           =   13200
         Begin VB.TextBox txt_Textbox 
            Alignment       =   1  'Right Justify
            Height          =   330
            Index           =   102
            Left            =   2115
            MaxLength       =   7
            TabIndex        =   409
            Tag             =   "RPL_MinPlanQty"
            Top             =   960
            Width           =   780
         End
         Begin VB.TextBox txt_Textbox 
            Alignment       =   1  'Right Justify
            Height          =   330
            Index           =   101
            Left            =   2115
            MaxLength       =   7
            TabIndex        =   408
            Tag             =   "RPL_MinStockLev"
            Top             =   615
            Width           =   780
         End
         Begin VB.TextBox txt_Textbox 
            Alignment       =   1  'Right Justify
            Height          =   330
            Index           =   100
            Left            =   2115
            MaxLength       =   7
            TabIndex        =   407
            Tag             =   "RPL_CodePlan"
            Top             =   270
            Width           =   780
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Min. planning quantity"
            Height          =   255
            Index           =   124
            Left            =   180
            TabIndex        =   412
            Tag             =   "lbl_RPL_MinPlanQty"
            Top             =   990
            Width           =   1965
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Min. stock level"
            Height          =   255
            Index           =   123
            Left            =   180
            TabIndex        =   411
            Tag             =   "lbl_RPL_MinStockLev"
            Top             =   660
            Width           =   1935
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Planning Code"
            Height          =   255
            Index           =   122
            Left            =   180
            TabIndex        =   410
            Tag             =   "lbl_RPL_CodePlan"
            Top             =   300
            Width           =   1980
         End
      End
      Begin VB.Frame fra_PackDetail 
         Height          =   2850
         Left            =   60
         TabIndex        =   360
         Tag             =   "fra_PackDetail"
         Top             =   195
         Width           =   13215
         Begin VB.CommandButton cmd_PrdPacking 
            Caption         =   "..."
            Height          =   375
            Left            =   5985
            TabIndex        =   403
            Tag             =   "cmd_PrdPacking"
            Top             =   450
            Width           =   450
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   98
            Left            =   8160
            TabIndex        =   380
            Tag             =   "PPA_VolLoad"
            Top             =   1110
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   97
            Left            =   4899
            MaxLength       =   17
            TabIndex        =   375
            Tag             =   "PPA_LayQtyA"
            Top             =   1080
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   96
            Left            =   4899
            TabIndex        =   377
            Tag             =   "PPA_LayQtyH"
            Top             =   2355
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   95
            Left            =   4899
            MaxLength       =   40
            TabIndex        =   376
            Tag             =   "PPA_LayQtyB"
            Top             =   1725
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   94
            Left            =   3351
            MaxLength       =   17
            TabIndex        =   372
            Tag             =   "PPA_CalcPalA"
            Top             =   1080
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   93
            Left            =   3351
            TabIndex        =   374
            Tag             =   "PPA_CalcPalH"
            Top             =   2355
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   91
            Left            =   3351
            MaxLength       =   40
            TabIndex        =   373
            Tag             =   "PPA_CalcPalB"
            Top             =   1725
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   90
            Left            =   1803
            MaxLength       =   17
            TabIndex        =   369
            Tag             =   "PPA_PalA"
            Top             =   1080
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   89
            Left            =   1803
            TabIndex        =   371
            Tag             =   "PPA_PalH"
            Top             =   2355
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   88
            Left            =   1803
            MaxLength       =   40
            TabIndex        =   370
            Tag             =   "PPA_PalB"
            Top             =   1725
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   84
            Left            =   3345
            TabIndex        =   363
            Tag             =   "PPA_PkgPalQty"
            Top             =   465
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   83
            Left            =   1800
            TabIndex        =   362
            Tag             =   "PPA_PalQty"
            Top             =   465
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   81
            Left            =   6450
            TabIndex        =   378
            Tag             =   "PPA_PalNetWgh"
            Top             =   1080
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   80
            Left            =   6450
            TabIndex        =   379
            Tag             =   "PPA_PkgNetWgh"
            Top             =   1725
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   92
            Left            =   240
            MaxLength       =   40
            TabIndex        =   367
            Tag             =   "PPA_PkgB"
            Top             =   1725
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   87
            Left            =   6450
            TabIndex        =   365
            Tag             =   "PPA_PalName"
            Top             =   465
            Width           =   6435
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   86
            Left            =   4899
            TabIndex        =   364
            Tag             =   "PPA_PalCode"
            Top             =   465
            Width           =   1125
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   85
            Left            =   255
            TabIndex        =   368
            Tag             =   "PPA_PkgH"
            Top             =   2355
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   82
            Left            =   255
            TabIndex        =   361
            Tag             =   "PPA_PkgQty"
            Top             =   465
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   79
            Left            =   255
            MaxLength       =   17
            TabIndex        =   366
            Tag             =   "PPA_PkgA"
            Top             =   1080
            Width           =   990
         End
         Begin Project1.ToolbarControl tlb_PackMain 
            Height          =   690
            Left            =   10065
            TabIndex        =   401
            Tag             =   "2983"
            Top             =   1620
            Visible         =   0   'False
            Width           =   2310
            _ExtentX        =   4075
            _ExtentY        =   1217
         End
         Begin Project1.ToolbarControl tlb_PackDetail 
            Height          =   690
            Left            =   8250
            TabIndex        =   402
            Tag             =   "2984"
            Top             =   1650
            Visible         =   0   'False
            Width           =   1200
            _ExtentX        =   2117
            _ExtentY        =   1217
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Volume load"
            Height          =   255
            Index           =   120
            Left            =   8160
            TabIndex        =   400
            Tag             =   "lbl_PPA_VolLoad"
            Top             =   840
            Width           =   1380
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Layout qty H"
            Height          =   255
            Index           =   119
            Left            =   4905
            TabIndex        =   399
            Tag             =   "lbl_PPA_LayQtyH"
            Top             =   2085
            Width           =   1380
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Layout qty B"
            Height          =   255
            Index           =   118
            Left            =   4905
            TabIndex        =   398
            Tag             =   "lbl_PPA_LayQtyB"
            Top             =   1470
            Width           =   1380
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Layout qty A"
            Height          =   255
            Index           =   117
            Left            =   4899
            TabIndex        =   397
            Tag             =   "lbl_PPA_LayQtyA"
            Top             =   810
            Width           =   1380
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Calc. palette H"
            Height          =   255
            Index           =   116
            Left            =   3345
            TabIndex        =   396
            Tag             =   "lbl_PPA_CalcPalH"
            Top             =   2085
            Width           =   1380
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Calc. palette B"
            Height          =   255
            Index           =   115
            Left            =   3345
            TabIndex        =   395
            Tag             =   "lbl_PPA_CalcPalB"
            Top             =   1470
            Width           =   1380
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Calc. palette A"
            Height          =   255
            Index           =   114
            Left            =   3345
            TabIndex        =   394
            Tag             =   "lbl_PPA_CalcPalA"
            Top             =   810
            Width           =   1380
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Palette H"
            Height          =   255
            Index           =   113
            Left            =   1800
            TabIndex        =   393
            Tag             =   "lbl_PPA_PalH"
            Top             =   2085
            Width           =   1380
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Palette B"
            Height          =   255
            Index           =   112
            Left            =   1800
            TabIndex        =   392
            Tag             =   "lbl_PPA_PalB"
            Top             =   1470
            Width           =   1380
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Palette A"
            Height          =   255
            Index           =   111
            Left            =   1800
            TabIndex        =   391
            Tag             =   "lbl_PPA_PalA"
            Top             =   810
            Width           =   1380
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Pkg on palette qty"
            Height          =   255
            Index           =   110
            Left            =   3345
            TabIndex        =   390
            Tag             =   "lbl_PPA_PkgPalQty"
            Top             =   225
            Width           =   1515
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Palette qty"
            Height          =   255
            Index           =   109
            Left            =   1800
            TabIndex        =   389
            Tag             =   "lbl_PPA_PalQty"
            Top             =   225
            Width           =   1515
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Palette name"
            Height          =   255
            Index           =   108
            Left            =   6450
            TabIndex        =   388
            Tag             =   "lbl_PPA_PalName"
            Top             =   225
            Width           =   1515
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Palette code"
            Height          =   255
            Index           =   107
            Left            =   4899
            TabIndex        =   387
            Tag             =   "lbl_PPA_PalCode"
            Top             =   225
            Width           =   1515
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Palette net wgh"
            Height          =   255
            Index           =   106
            Left            =   6450
            TabIndex        =   386
            Tag             =   "lbl_PPA_PalNetWgh"
            Top             =   810
            Width           =   1380
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Package net wgh"
            Height          =   255
            Index           =   105
            Left            =   6450
            TabIndex        =   385
            Tag             =   "lbl_PPA_PkgNetWgh"
            Top             =   1470
            Width           =   1380
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#PkgH"
            Height          =   255
            Index           =   68
            Left            =   255
            TabIndex        =   384
            Tag             =   "lbl_PPA_PkgH"
            Top             =   2085
            Width           =   1380
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#PkgB"
            Height          =   255
            Index           =   66
            Left            =   255
            TabIndex        =   383
            Tag             =   "lbl_PPA_PkgB"
            Top             =   1470
            Width           =   1380
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#PkgA"
            Height          =   255
            Index           =   51
            Left            =   255
            TabIndex        =   382
            Tag             =   "lbl_PPA_PkgA"
            Top             =   810
            Width           =   1380
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Package qty"
            Height          =   255
            Index           =   8
            Left            =   255
            TabIndex        =   381
            Tag             =   "lbl_PPA_PkgQty"
            Top             =   225
            Width           =   990
         End
      End
   End
   Begin VB.CommandButton btn_Error 
      Height          =   612
      Left            =   12795
      Style           =   1  'Graphical
      TabIndex        =   336
      Tag             =   "btn_Error"
      Top             =   10395
      Width           =   612
   End
   Begin VB.Frame fra_Detail 
      Caption         =   "#BOR"
      Height          =   1500
      Index           =   5
      Left            =   3375
      TabIndex        =   219
      Tag             =   "fra_BOR"
      Top             =   2790
      Width           =   2070
      Begin VB.Frame fra_BORDetail 
         Height          =   780
         Left            =   30
         TabIndex        =   220
         Tag             =   "fra_BORDetail"
         Top             =   930
         Width           =   17235
         Begin VB.CommandButton cmd_BOR_StagNr 
            Caption         =   "..."
            Height          =   345
            Left            =   6900
            TabIndex        =   230
            Tag             =   "cmd_BOR_StagNr"
            Top             =   375
            Width           =   360
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   122
            Left            =   795
            MaxLength       =   17
            TabIndex        =   228
            Tag             =   "BOR_StagNr"
            Top             =   375
            Width           =   1215
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   119
            Left            =   75
            TabIndex        =   227
            Tag             =   "BOR_Pos"
            Top             =   375
            Width           =   735
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   330
            Index           =   124
            Left            =   10305
            TabIndex        =   235
            Tag             =   "BOR_Te"
            Top             =   375
            Width           =   800
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   330
            Index           =   125
            Left            =   7935
            TabIndex        =   232
            Tag             =   "BOR_Tr"
            Top             =   375
            Width           =   800
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   330
            Index           =   126
            Left            =   9510
            TabIndex        =   234
            Tag             =   "BOR_Lgtr"
            Top             =   375
            Width           =   800
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   330
            Index           =   127
            Left            =   8730
            TabIndex        =   233
            Tag             =   "BOR_Brtr"
            Top             =   375
            Width           =   800
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   330
            Index           =   128
            Left            =   5010
            TabIndex        =   226
            Tag             =   "BOR_Lgrp"
            Top             =   1305
            Visible         =   0   'False
            Width           =   1230
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   330
            Index           =   130
            Left            =   7275
            TabIndex        =   231
            Tag             =   "BOR_Anz_Bedien"
            Top             =   375
            Width           =   660
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   330
            Index           =   129
            Left            =   11100
            TabIndex        =   236
            Tag             =   "BOR_VarPerFact"
            Top             =   375
            Width           =   800
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   131
            Left            =   8250
            TabIndex        =   225
            Tag             =   "BOR_Cost"
            Top             =   1215
            Visible         =   0   'False
            Width           =   1215
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   132
            Left            =   11040
            TabIndex        =   224
            Tag             =   "BOR_TotCost"
            Top             =   1215
            Visible         =   0   'False
            Width           =   1215
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   330
            Index           =   123
            Left            =   11895
            TabIndex        =   238
            Tag             =   "BOR_WghPnt"
            Top             =   375
            Width           =   930
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   330
            Index           =   120
            Left            =   8490
            TabIndex        =   223
            Tag             =   "BOR_StatusDesc"
            Top             =   810
            Visible         =   0   'False
            Width           =   1230
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   133
            Left            =   12510
            TabIndex        =   222
            Tag             =   "BOR_CURR_Code"
            Top             =   1260
            Visible         =   0   'False
            Width           =   870
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   116
            Left            =   2010
            MaxLength       =   40
            TabIndex        =   229
            Tag             =   "BOR_Name"
            Top             =   375
            Width           =   4890
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   136
            Left            =   1815
            TabIndex        =   221
            Tag             =   "BOR_KostSt"
            Top             =   795
            Visible         =   0   'False
            Width           =   1215
         End
         Begin Project1.ToolbarControl tlb_BORDetail 
            Height          =   690
            Left            =   15435
            TabIndex        =   237
            Tag             =   "2923"
            Top             =   90
            Width           =   1200
            _ExtentX        =   2117
            _ExtentY        =   1217
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Wgh point"
            Height          =   255
            Index           =   89
            Left            =   11910
            TabIndex        =   310
            Tag             =   "lbl_BOR_WghPnt"
            Top             =   135
            Width           =   930
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Cost"
            Height          =   255
            Index           =   59
            Left            =   6540
            TabIndex        =   251
            Tag             =   "lbl_BORCost"
            Top             =   1275
            Visible         =   0   'False
            Width           =   1680
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Std. routing"
            Height          =   255
            Index           =   58
            Left            =   825
            TabIndex        =   250
            Tag             =   "lbl_BORStdRouting"
            Top             =   135
            Width           =   1680
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Position"
            Height          =   255
            Index           =   72
            Left            =   105
            TabIndex        =   249
            Tag             =   "lbl_BORPosition"
            Top             =   135
            Width           =   1680
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Cost centre"
            Height          =   255
            Index           =   73
            Left            =   90
            TabIndex        =   248
            Tag             =   "lbl_BORCostCentre"
            Top             =   870
            Visible         =   0   'False
            Width           =   1680
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Op. time"
            Height          =   255
            Index           =   79
            Left            =   10290
            TabIndex        =   247
            Tag             =   "lbl_BOROperationTime"
            Top             =   135
            Width           =   825
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Bs time"
            Height          =   255
            Index           =   80
            Left            =   7935
            TabIndex        =   246
            Tag             =   "lbl_BORBaseSetupTime"
            Top             =   135
            Width           =   810
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Sl time"
            Height          =   255
            Index           =   81
            Left            =   9525
            TabIndex        =   245
            Tag             =   "lbl_BORSetupTimeLength"
            Top             =   135
            Width           =   780
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Sw time"
            Height          =   255
            Index           =   82
            Left            =   8745
            TabIndex        =   244
            Tag             =   "lbl_BORSetupTimeWidth"
            Top             =   135
            Width           =   810
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Salary group"
            Height          =   255
            Index           =   86
            Left            =   3300
            TabIndex        =   243
            Tag             =   "lbl_BORSalaryGroup"
            Top             =   1350
            Visible         =   0   'False
            Width           =   1680
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Op.cnt"
            Height          =   255
            Index           =   87
            Left            =   7260
            TabIndex        =   242
            Tag             =   "lbl_BOROperatorCount"
            Top             =   135
            Width           =   1275
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Sal.fact."
            Height          =   255
            Index           =   91
            Left            =   11100
            TabIndex        =   241
            Tag             =   "lbl_BORSalaryFactor"
            Top             =   135
            Width           =   810
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Total cost"
            Height          =   255
            Index           =   90
            Left            =   9630
            TabIndex        =   240
            Tag             =   "lbl_BORTotCost"
            Top             =   1275
            Visible         =   0   'False
            Width           =   1740
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Status"
            Height          =   255
            Index           =   88
            Left            =   6645
            TabIndex        =   239
            Tag             =   "lbl_BORStatus"
            Top             =   855
            Visible         =   0   'False
            Width           =   1740
         End
      End
      Begin Project1.ToolbarControl tlb_BORMain 
         Height          =   690
         Left            =   60
         TabIndex        =   252
         Tag             =   "2922"
         Top             =   210
         Width           =   10860
         _ExtentX        =   19156
         _ExtentY        =   1217
      End
      Begin Project1.ArmGrid grd_BOR 
         Height          =   2415
         Left            =   120
         TabIndex        =   253
         Tag             =   "grd_BOR"
         Top             =   825
         Width           =   4365
         _ExtentX        =   7699
         _ExtentY        =   4260
      End
   End
   Begin VB.Frame fra_Detail 
      Caption         =   "#BOM"
      Height          =   3615
      Index           =   4
      Left            =   7680
      TabIndex        =   254
      Tag             =   "fra_BOM"
      Top             =   2700
      Width           =   8040
      Begin VB.Frame fra_BOMDetail 
         Height          =   800
         Left            =   150
         TabIndex        =   255
         Tag             =   "fra_BOMDetail"
         Top             =   990
         Width           =   17235
         Begin VB.CommandButton cmd_BOM_IdentNr 
            Caption         =   "..."
            Height          =   345
            Left            =   7410
            TabIndex        =   266
            Tag             =   "cmd_BOM_IdentNr"
            Top             =   330
            Width           =   360
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   330
            Index           =   137
            Left            =   1065
            MaxLength       =   17
            TabIndex        =   264
            Tag             =   "BOM_IdentNr"
            Top             =   330
            Width           =   1230
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   138
            Left            =   1950
            TabIndex        =   271
            Tag             =   "BOM_Material"
            Top             =   1410
            Visible         =   0   'False
            Width           =   6840
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   330
            Index           =   135
            Left            =   13875
            TabIndex        =   270
            Tag             =   "BOM_StatusDesc"
            Top             =   1680
            Visible         =   0   'False
            Width           =   1230
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   134
            Left            =   60
            TabIndex        =   263
            Tag             =   "BOM_Pos"
            Top             =   330
            Width           =   990
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   143
            Left            =   11820
            TabIndex        =   262
            Tag             =   "BOM_CURR_Code"
            Top             =   1035
            Visible         =   0   'False
            Width           =   870
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   142
            Left            =   10440
            TabIndex        =   261
            Tag             =   "BOM_TotCost"
            Top             =   1035
            Visible         =   0   'False
            Width           =   1215
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   139
            Left            =   7800
            TabIndex        =   267
            Tag             =   "BOM_Qty"
            Top             =   330
            Width           =   1215
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   141
            Left            =   9780
            TabIndex        =   269
            Tag             =   "BOM_Cost"
            Top             =   330
            Width           =   1215
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   140
            Left            =   9030
            TabIndex        =   268
            Tag             =   "BOM_UM_Name"
            Top             =   330
            Width           =   735
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   50
            Left            =   1950
            TabIndex        =   260
            Tag             =   "BOM_SpecWeight"
            Top             =   1785
            Visible         =   0   'False
            Width           =   1215
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   113
            Left            =   5115
            TabIndex        =   259
            Tag             =   "BOM_Productivity"
            Top             =   1785
            Visible         =   0   'False
            Width           =   1215
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   114
            Left            =   7575
            TabIndex        =   258
            Tag             =   "BOM_CutLength"
            Top             =   1785
            Visible         =   0   'False
            Width           =   1215
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   115
            Left            =   10455
            TabIndex        =   257
            Tag             =   "BOM_CutWidth"
            Top             =   1785
            Visible         =   0   'False
            Width           =   1215
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   330
            Index           =   121
            Left            =   2325
            MaxLength       =   40
            TabIndex        =   265
            Tag             =   "BOM_Name"
            Top             =   330
            Width           =   5100
         End
         Begin VB.TextBox txt_Textbox 
            Height          =   345
            Index           =   145
            Left            =   5130
            TabIndex        =   256
            Tag             =   "BOM_SalesPriceUnit"
            Top             =   1020
            Visible         =   0   'False
            Width           =   1215
         End
         Begin Project1.ToolbarControl tlb_BOMDetail 
            Height          =   690
            Left            =   15930
            TabIndex        =   272
            Tag             =   "2921"
            Top             =   90
            Width           =   1200
            _ExtentX        =   2117
            _ExtentY        =   1217
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Article"
            Height          =   255
            Index           =   63
            Left            =   2340
            TabIndex        =   284
            Tag             =   "lbl_BOMArticle"
            Top             =   120
            Width           =   1815
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Status"
            Height          =   255
            Index           =   84
            Left            =   12195
            TabIndex        =   283
            Tag             =   "lbl_BOMStatus"
            Top             =   1695
            Visible         =   0   'False
            Width           =   1395
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Position"
            Height          =   255
            Index           =   85
            Left            =   60
            TabIndex        =   282
            Tag             =   "lbl_BOMPosition"
            Top             =   120
            Width           =   975
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Material"
            Height          =   255
            Index           =   83
            Left            =   120
            TabIndex        =   281
            Tag             =   "lbl_BOMMaterial"
            Top             =   1455
            Visible         =   0   'False
            Width           =   1815
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Total cost"
            Height          =   255
            Index           =   77
            Left            =   8940
            TabIndex        =   280
            Tag             =   "lbl_BOMTotCost"
            Top             =   1065
            Visible         =   0   'False
            Width           =   1395
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Quantity"
            Height          =   255
            Index           =   74
            Left            =   7860
            TabIndex        =   279
            Tag             =   "lbl_BOMQuantity"
            Top             =   120
            Width           =   1110
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Cost"
            Height          =   255
            Index           =   62
            Left            =   9780
            TabIndex        =   278
            Tag             =   "lbl_BOMCost"
            Top             =   120
            Width           =   1170
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Density"
            Height          =   255
            Index           =   61
            Left            =   120
            TabIndex        =   277
            Tag             =   "lbl_BOMDensity"
            Top             =   1845
            Visible         =   0   'False
            Width           =   1815
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Productivity"
            Height          =   255
            Index           =   75
            Left            =   3285
            TabIndex        =   276
            Tag             =   "lbl_BOMProductivity"
            Top             =   1815
            Visible         =   0   'False
            Width           =   1395
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Cut length"
            Height          =   255
            Index           =   76
            Left            =   6495
            TabIndex        =   275
            Tag             =   "lbl_BOMCutLength"
            Top             =   1815
            Visible         =   0   'False
            Width           =   1395
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Cut width"
            Height          =   255
            Index           =   78
            Left            =   8955
            TabIndex        =   274
            Tag             =   "lbl_BOMCutWidth"
            Top             =   1815
            Visible         =   0   'False
            Width           =   1395
         End
         Begin VB.Label lbl_Label 
            Caption         =   "#Price unit"
            Height          =   255
            Index           =   60
            Left            =   4185
            TabIndex        =   273
            Tag             =   "lbl_BOMPriceUnit"
            Top             =   1080
            Visible         =   0   'False
            Width           =   840
         End
      End
      Begin Project1.ArmGrid grd_BOM 
         Height          =   2415
         Left            =   195
         TabIndex        =   285
         Tag             =   "grd_BOM"
         Top             =   1830
         Width           =   4365
         _ExtentX        =   7699
         _ExtentY        =   4260
      End
      Begin Project1.ToolbarControl tlb_BOMMain 
         Height          =   690
         Left            =   60
         TabIndex        =   286
         Tag             =   "2920"
         Top             =   210
         Width           =   10860
         _ExtentX        =   19156
         _ExtentY        =   1217
      End
   End
   Begin VB.Frame fra_Detail 
      Height          =   1740
      Index           =   2
      Left            =   3015
      TabIndex        =   299
      Tag             =   "fra_BOM"
      Top             =   8460
      Width           =   4860
      Begin VB.TextBox txt_Textbox 
         Height          =   900
         Index           =   62
         Left            =   420
         MaxLength       =   250
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   300
         Tag             =   "PRD_InternalComment"
         Top             =   420
         Width           =   3870
      End
   End
   Begin VB.Frame fra_Detail 
      Caption         =   "#Files"
      Height          =   4785
      Index           =   8
      Left            =   420
      TabIndex        =   296
      Tag             =   "fra_Files"
      Top             =   6090
      Width           =   15855
      Begin Project1.ArmGrid grd_File 
         Height          =   2640
         Left            =   90
         TabIndex        =   297
         Tag             =   "grd_File"
         Top             =   210
         Width           =   14220
         _ExtentX        =   25083
         _ExtentY        =   4657
      End
      Begin Project1.ToolbarControl tlb_File 
         Height          =   2775
         Left            =   14355
         TabIndex        =   298
         Tag             =   "2962"
         Top             =   105
         Width           =   690
         _ExtentX        =   1217
         _ExtentY        =   4895
      End
   End
   Begin VB.Frame fra_Detail 
      Caption         =   "#Cost"
      Height          =   2520
      Index           =   6
      Left            =   8310
      TabIndex        =   289
      Tag             =   "fra_PanelCost"
      Top             =   7365
      Width           =   3345
      Begin Project1.ArmGrid grd_CostCalc 
         Height          =   9150
         Left            =   180
         TabIndex        =   290
         Tag             =   "grd_CostCalc"
         Top             =   255
         Width           =   14880
         _ExtentX        =   26247
         _ExtentY        =   16140
      End
   End
   Begin MSComctlLib.TabStrip tbs_Main 
      Height          =   345
      Left            =   3540
      TabIndex        =   45
      Tag             =   "tbs_Main"
      Top             =   2340
      Width           =   8235
      _ExtentX        =   14526
      _ExtentY        =   609
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   9
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "#Data"
            Key             =   "tbs_Data"
            Object.Tag             =   "tbs_Data"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab2 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "#Offer Comment"
            Key             =   "tbs_OfferComment"
            Object.Tag             =   "tbs_OfferComment"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab3 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "#Internal Comment"
            Key             =   "tbs_InternalComment"
            Object.Tag             =   "tbs_InternalComment"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab4 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "#Packing"
            Key             =   "tbs_Packing"
            Object.Tag             =   "tbs_Packing"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab5 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "#BOM"
            Key             =   "tbs_BOM"
            Object.Tag             =   "tbs_BOM"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab6 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "#BOR"
            Key             =   "tbs_BOR"
            Object.Tag             =   "tbs_BOR"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab7 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "#Cost"
            Key             =   "tbs_PanelCost"
            Object.Tag             =   "tbs_PanelCost"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab8 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "#Attributes"
            Key             =   "tbs_Attribute"
            Object.Tag             =   "tbs_Attribute"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab9 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "#Files"
            Key             =   "tbs_File"
            Object.Tag             =   "tbs_File"
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin VB.Frame fra_Header 
      Height          =   2355
      Left            =   60
      TabIndex        =   2
      Tag             =   "fra_Header"
      Top             =   -30
      Width           =   15120
      Begin VB.TextBox txt_Textbox 
         Alignment       =   1  'Right Justify
         Height          =   330
         Index           =   104
         Left            =   14130
         MaxLength       =   7
         TabIndex        =   37
         TabStop         =   0   'False
         Tag             =   "RPL_BaeType"
         Top             =   1830
         Width           =   900
      End
      Begin VB.TextBox txt_Textbox 
         Alignment       =   1  'Right Justify
         Height          =   330
         Index           =   103
         Left            =   11550
         MaxLength       =   7
         TabIndex        =   36
         Tag             =   "RPL_NWgh"
         Top             =   1815
         Width           =   900
      End
      Begin VB.TextBox txt_Textbox 
         Alignment       =   1  'Right Justify
         Height          =   330
         Index           =   65
         Left            =   11550
         MaxLength       =   7
         TabIndex        =   29
         Tag             =   "RPL_CoilW"
         Top             =   495
         Width           =   900
      End
      Begin VB.TextBox txt_Textbox 
         Alignment       =   1  'Right Justify
         Height          =   330
         Index           =   63
         Left            =   11550
         MaxLength       =   7
         TabIndex        =   31
         Tag             =   "RPL_CoWMin"
         Top             =   825
         Width           =   900
      End
      Begin VB.TextBox txt_Textbox 
         Height          =   330
         Index           =   14
         Left            =   11550
         MaxLength       =   30
         TabIndex        =   35
         Tag             =   "RPL_DrwNr"
         Top             =   1485
         Width           =   3480
      End
      Begin VB.TextBox txt_Textbox 
         Alignment       =   1  'Right Justify
         Height          =   330
         Index           =   13
         Left            =   11550
         MaxLength       =   7
         TabIndex        =   33
         Tag             =   "RPL_CutA"
         Top             =   1155
         Width           =   900
      End
      Begin VB.CheckBox chk_RPL_CusDim 
         Caption         =   "#Cut (L)"
         Height          =   270
         Index           =   2
         Left            =   10035
         TabIndex        =   339
         Tag             =   "lbl_RPL_CutA"
         Top             =   1185
         Width           =   1545
      End
      Begin VB.CheckBox chk_RPL_CusDim 
         Caption         =   "#Coil width min"
         Height          =   270
         Index           =   1
         Left            =   10035
         TabIndex        =   338
         Tag             =   "lbl_RPL_CoWMin"
         Top             =   855
         Width           =   1545
      End
      Begin VB.CheckBox chk_RPL_CusDim 
         Caption         =   "#Coil width [mm]"
         Height          =   270
         Index           =   0
         Left            =   10035
         TabIndex        =   337
         Tag             =   "lbl_RPL_CoilW"
         Top             =   525
         Width           =   1545
      End
      Begin VB.CommandButton cmd_Copy 
         Caption         =   "#Copy"
         Height          =   315
         Left            =   3150
         TabIndex        =   309
         Tag             =   "cmd_Copy"
         Top             =   795
         Width           =   1020
      End
      Begin VB.TextBox txt_Textbox 
         Alignment       =   1  'Right Justify
         Height          =   330
         Index           =   64
         Left            =   14130
         MaxLength       =   7
         TabIndex        =   32
         Tag             =   "RPL_CoWMax"
         Top             =   825
         Width           =   900
      End
      Begin VB.CheckBox chk_ASFlag 
         Caption         =   "#AS Item"
         Height          =   225
         Left            =   3210
         TabIndex        =   304
         Tag             =   "chk_ASFlag"
         Top             =   510
         Width           =   1500
      End
      Begin VB.CheckBox chk_FreeOfCharge 
         Caption         =   "#Free of charge"
         Height          =   225
         Left            =   3195
         TabIndex        =   303
         Tag             =   "chk_FreeOfCharge"
         Top             =   180
         Width           =   1560
      End
      Begin VB.TextBox txt_Textbox 
         Alignment       =   1  'Right Justify
         Height          =   330
         Index           =   11
         Left            =   6570
         MaxLength       =   7
         TabIndex        =   21
         Tag             =   "PanelSurface"
         Top             =   795
         Width           =   780
      End
      Begin VB.TextBox txt_Textbox 
         Alignment       =   1  'Right Justify
         Height          =   330
         Index           =   12
         Left            =   14130
         MaxLength       =   7
         TabIndex        =   34
         Tag             =   "RPL_CutB"
         Top             =   1155
         Width           =   900
      End
      Begin VB.TextBox txt_Textbox 
         Alignment       =   1  'Right Justify
         Height          =   330
         Index           =   8
         Left            =   14130
         TabIndex        =   28
         Tag             =   "RPL_MatTyp"
         Top             =   165
         Width           =   900
      End
      Begin VB.TextBox txt_Textbox 
         Alignment       =   1  'Right Justify
         Height          =   330
         Index           =   5
         Left            =   14130
         MaxLength       =   7
         TabIndex        =   30
         Tag             =   "RPL_Thick"
         Top             =   495
         Width           =   900
      End
      Begin VB.TextBox txt_Textbox 
         Alignment       =   1  'Right Justify
         Height          =   330
         Index           =   10
         Left            =   9180
         MaxLength       =   7
         TabIndex        =   16
         Tag             =   "RPL_PanB"
         Top             =   135
         Width           =   780
      End
      Begin VB.TextBox txt_Textbox 
         Alignment       =   1  'Right Justify
         Height          =   330
         Index           =   9
         Left            =   6570
         MaxLength       =   7
         TabIndex        =   15
         Tag             =   "RPL_PanA"
         Top             =   135
         Width           =   780
      End
      Begin VB.TextBox txt_Textbox 
         Alignment       =   1  'Right Justify
         Height          =   330
         Index           =   7
         Left            =   9180
         MaxLength       =   7
         TabIndex        =   20
         Tag             =   "RPL_ModB"
         Top             =   465
         Width           =   780
      End
      Begin VB.TextBox txt_Textbox 
         Alignment       =   1  'Right Justify
         Height          =   330
         Index           =   6
         Left            =   6570
         MaxLength       =   7
         TabIndex        =   18
         Tag             =   "RPL_ModA"
         Top             =   465
         Width           =   780
      End
      Begin VB.TextBox txt_Textbox 
         Height          =   330
         Index           =   1
         Left            =   1695
         TabIndex        =   12
         TabStop         =   0   'False
         Tag             =   "PRD_Code"
         Top             =   795
         Width           =   1455
      End
      Begin VB.TextBox txt_Textbox 
         Alignment       =   1  'Right Justify
         Height          =   330
         Index           =   4
         Left            =   3135
         TabIndex        =   8
         Tag             =   "PanelQtyM2"
         Top             =   1125
         Width           =   1125
      End
      Begin VB.TextBox txt_Textbox 
         Alignment       =   1  'Right Justify
         Height          =   330
         Index           =   3
         Left            =   1695
         TabIndex        =   7
         Tag             =   "PanelQtyPCS"
         Top             =   1125
         Width           =   885
      End
      Begin VB.TextBox txt_Textbox 
         Height          =   330
         Index           =   53
         Left            =   1695
         TabIndex        =   5
         Tag             =   "OFD_Pos"
         Top             =   135
         Width           =   1440
      End
      Begin VB.TextBox txt_Textbox 
         Height          =   330
         Index           =   2
         Left            =   1695
         MaxLength       =   30
         TabIndex        =   3
         Tag             =   "OFD_PosCus"
         Top             =   465
         Width           =   1455
      End
      Begin Project1.ArmCombobox cbo_Material 
         Height          =   345
         Left            =   11550
         TabIndex        =   27
         Top             =   150
         Width           =   1755
         _ExtentX        =   3096
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_Vendor 
         Height          =   345
         Left            =   6570
         TabIndex        =   22
         Top             =   1125
         Width           =   3420
         _ExtentX        =   6033
         _ExtentY        =   609
      End
      Begin Project1.ArmCombobox cbo_ShipPoint 
         Height          =   345
         Left            =   6570
         TabIndex        =   23
         Top             =   1470
         Width           =   3420
         _ExtentX        =   6033
         _ExtentY        =   609
      End
      Begin Project1.A_calocx cal_OFD_WshDat 
         Height          =   360
         Left            =   1695
         TabIndex        =   24
         Tag             =   "OFD_WshDat"
         Top             =   1815
         Width           =   1845
         _ExtentX        =   3254
         _ExtentY        =   635
      End
      Begin Project1.A_calocx cal_OFD_DelDat 
         Height          =   360
         Left            =   8475
         TabIndex        =   26
         Tag             =   "OFD_DelDat"
         Top             =   1815
         Width           =   1845
         _ExtentX        =   3254
         _ExtentY        =   635
      End
      Begin Project1.A_calocx cal_OFD_ShpDat 
         Height          =   360
         Left            =   5070
         TabIndex        =   25
         Tag             =   "OFD_ShpDat"
         Top             =   1815
         Width           =   1845
         _ExtentX        =   3254
         _ExtentY        =   635
      End
      Begin VB.TextBox txt_Textbox 
         Height          =   330
         Index           =   0
         Left            =   1695
         MaxLength       =   80
         TabIndex        =   9
         Tag             =   "PRD_Name"
         Top             =   1455
         Width           =   2880
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#BaseType"
         Height          =   255
         Index           =   126
         Left            =   12690
         TabIndex        =   414
         Tag             =   "lbl_RPL_BaeType"
         Top             =   1905
         Width           =   1440
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Weight"
         Height          =   255
         Index           =   125
         Left            =   10380
         TabIndex        =   413
         Tag             =   "lbl_RPL_NWgh"
         Top             =   1890
         Width           =   1200
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Requested date"
         Height          =   255
         Index           =   71
         Left            =   90
         TabIndex        =   308
         Tag             =   "lbl_OFD_WshDat"
         Top             =   1868
         Width           =   1620
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Delivery date"
         Height          =   255
         Index           =   70
         Left            =   6975
         TabIndex        =   307
         Tag             =   "lbl_OFD_DelDat"
         Top             =   1868
         Width           =   1470
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Shipment date"
         Height          =   255
         Index           =   69
         Left            =   3570
         TabIndex        =   306
         Tag             =   "lbl_OFD_ShpDat"
         Top             =   1868
         Width           =   1470
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Coil width max"
         Height          =   255
         Index           =   67
         Left            =   12690
         TabIndex        =   305
         Tag             =   "lbl_RPL_CoWMax"
         Top             =   870
         Width           =   1470
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Plant/Vendor"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   238
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Index           =   65
         Left            =   4815
         TabIndex        =   302
         Tag             =   "lbl_PlantVendor"
         Top             =   1170
         Width           =   1395
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Shipping point"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   238
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Index           =   64
         Left            =   4815
         TabIndex        =   301
         Tag             =   "lbl_ShipPoint"
         Top             =   1515
         Width           =   1395
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Code"
         Height          =   255
         Index           =   55
         Left            =   90
         TabIndex        =   217
         Tag             =   "lbl_PanelCode"
         Top             =   840
         Width           =   1530
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#m2"
         Height          =   255
         Index           =   23
         Left            =   7440
         TabIndex        =   195
         Tag             =   "lbl_UM_CodeM2"
         Top             =   840
         Width           =   645
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Surface"
         Height          =   255
         Index           =   6
         Left            =   4830
         TabIndex        =   53
         Tag             =   "lbl_PanelSurface"
         Top             =   855
         Width           =   1725
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Drawing nr."
         Height          =   255
         Index           =   9
         Left            =   10095
         TabIndex        =   44
         Tag             =   "lbl_RPL_DrwNr"
         Top             =   1530
         Width           =   1440
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Cut (W)"
         Height          =   255
         Index           =   7
         Left            =   12690
         TabIndex        =   43
         Tag             =   "lbl_RPL_CutB"
         Top             =   1200
         Width           =   1455
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Type"
         Height          =   255
         Index           =   5
         Left            =   13335
         TabIndex        =   42
         Tag             =   "lbl_MatType"
         Top             =   210
         Width           =   855
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Thickness [mm]"
         Height          =   255
         Index           =   10
         Left            =   12705
         TabIndex        =   41
         Tag             =   "lbl_Thickness"
         Top             =   540
         Width           =   1395
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Material"
         Height          =   285
         Index           =   57
         Left            =   10095
         TabIndex        =   40
         Tag             =   "lbl_Material"
         Top             =   195
         Width           =   1440
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Panel width B [mm]"
         Height          =   255
         Index           =   16
         Left            =   7410
         TabIndex        =   39
         Tag             =   "lbl_PanelB"
         Top             =   180
         Width           =   1725
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Panel length A [mm]"
         Height          =   255
         Index           =   14
         Left            =   4830
         TabIndex        =   38
         Tag             =   "lbl_PanelA"
         Top             =   210
         Width           =   1725
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Module width [mm]"
         Height          =   255
         Index           =   4
         Left            =   7425
         TabIndex        =   19
         Tag             =   "lbl_ModuleB"
         Top             =   510
         Width           =   1755
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Module length [mm]"
         Height          =   255
         Index           =   3
         Left            =   4830
         TabIndex        =   17
         Tag             =   "lbl_ModuleA"
         Top             =   525
         Width           =   1725
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#m2"
         Height          =   255
         Index           =   2
         Left            =   4290
         TabIndex        =   14
         Tag             =   "lbl_UM_CodeM2"
         Top             =   1170
         Width           =   480
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#pcs"
         Height          =   255
         Index           =   1
         Left            =   2610
         TabIndex        =   13
         Tag             =   "lbl_UM_CodePCS"
         Top             =   1170
         Width           =   495
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Quantity"
         Height          =   255
         Index           =   0
         Left            =   90
         TabIndex        =   11
         Tag             =   "lbl_PanelQty"
         Top             =   1200
         Width           =   1500
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Name"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   238
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Index           =   54
         Left            =   90
         TabIndex        =   10
         Tag             =   "lbl_PanelName"
         Top             =   1500
         Width           =   1230
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Armstrong position"
         Height          =   255
         Index           =   53
         Left            =   90
         TabIndex        =   6
         Tag             =   "lbl_OFD_Pos"
         Top             =   195
         Width           =   1455
      End
      Begin VB.Label lbl_Label 
         Caption         =   "#Customer position"
         Height          =   255
         Index           =   56
         Left            =   90
         TabIndex        =   4
         Tag             =   "lbl_PanelCodeC"
         Top             =   510
         Width           =   1500
      End
   End
   Begin VB.CommandButton btn_Quit 
      Height          =   612
      Left            =   14550
      Style           =   1  'Graphical
      TabIndex        =   1
      Tag             =   "btn_Quit"
      Top             =   10380
      Width           =   612
   End
   Begin VB.CommandButton btn_Validate 
      Height          =   612
      Left            =   13935
      Style           =   1  'Graphical
      TabIndex        =   0
      Tag             =   "btn_Validate"
      Top             =   10380
      Width           =   612
   End
   Begin VB.Frame fra_Detail 
      Height          =   1740
      Index           =   1
      Left            =   3030
      TabIndex        =   50
      Tag             =   "fra_BOM"
      Top             =   6480
      Width           =   4860
      Begin VB.TextBox txt_Textbox 
         Height          =   900
         Index           =   146
         Left            =   420
         MaxLength       =   250
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   218
         Tag             =   "PRD_OfferComment"
         Top             =   420
         Width           =   3870
      End
   End
   Begin MSComctlLib.ImageList iml_Icons 
      Left            =   465
      Top             =   8235
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483633
      MaskColor       =   16711935
      _Version        =   393216
   End
   Begin Project1.ArmCombobox cbo_Level 
      Height          =   345
      Left            =   11505
      TabIndex        =   358
      Top             =   10560
      Width           =   630
      _ExtentX        =   1111
      _ExtentY        =   609
   End
   Begin VB.Label lbl_Label 
      Caption         =   "#Level"
      Height          =   255
      Index           =   104
      Left            =   10470
      TabIndex        =   359
      Tag             =   "lbl_SummaryLevel"
      Top             =   10605
      Width           =   975
   End
End
Attribute VB_Name = "DPC_ConfigSpc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Private Const SEP = "®©"
Private Const C_SEP As String = "@@"
Private Const SEP1 As String = "®"
Private Const SEP2 As String = "©"
Private Const CL_COLOR_ENABLED As Long = &H80000005
Private Const CL_COLOR_DISABLED As Long = &H8000000F
Private Const SCREEN_NAME As String = "DPC_ConfigSpc"
Private Const SW_SHOWNORMAL = 1

Private Const LOCALE_SDECIMAL = &HE ' Decimal separator
Private Const LOCALE_STHOUSAND = &HF ' Thousand separator
Private Const LOCALE_USER_DEFAULT = &H400
Private Const C_ERRORRAISE As Long = 2500
Private Const C_MSG_ID_BASE As Long = 9700

#If ENV = LIVE Then
Private mo_Sys As Object
Private mo_Db As Object
Private mo_DbBaeurer As Object
Private mo_FSO As Object
#Else
Private mo_Sys As ARMSYSCOMLib.ArmSYS
Private mo_Db As ARMSYSCOMLib.ArmDb
Private mo_DbBaeurer As ARMSYSCOMLib.ArmDb
Private mo_FSO As Scripting.FileSystemObject
#End If

Private mo_Tools As DPC_Tools

Public Result As Boolean
Private ml_U_Code As Long

Private ms_Caption As String
Private ms_DPCImageCachePath As String

Public mo_PrdConfig As New DPC_Product
Private mo_PrdTemp As New DPC_Product
Private mo_CurrentBOM As DPC_BOM
Private mo_CurrentBOR As DPC_BOR

Private me_BOMScreen As eDPCScreenMode
Private me_BORScreen As eDPCScreenMode
Private me_PrdScreen As eDPCScreenMode
Private me_PackScreen As eDPCScreenMode

Private mb_Initialized As Boolean
Private ms_DecimalSeparator As String
Private ms_ThousandSeparator As String
Private mc_ScreenLabels As Long
Private mc_Toolbars As Long
Private mo_WshNetwork As Object
Private ms_ComputerName As String
Private ms_Language_Code                As String       'current user interface language
Private ms_COF_Lang                     As String       'current user data language
Private ms_LoginName                    As String       'contain loginname
Private ms_UserName                     As String       'contain name of logged user as defined in GEN_People

Private mb_InternalInit As Boolean
Private mb_CurrentTextBoxChanged As Boolean
Private mb_IsProduction As Boolean
Private mv_Edge As Variant

Private ms_BaeurerServer As String
Private ms_BaeurerDatabase As String
Private ms_BaeurerLoginName As String
Private ms_BaeurerPassword As String
Private ms_BaeurerSource As String
Private ml_BaeurerFi_Nr As Long

Private Enum ArmErr
    DBCnxFailed = vbObjectError + 1             ' Unable to connect to the database
    CPTAlreadyInitialized = vbObjectError + 2   ' We try to initialize a component that is already initialized
    CPTNotInitialized = vbObjectError + 3       ' We try to use or free that is not initialized yet
    InvalidArgument = vbObjectError + 4
    PropertyNotSet = vbObjectError + 5
    SQLFailure = vbObjectError + 6               ' A SQL runtime error has occured : syntax wrong....
    SQLBadRowAffectedCount = vbObjectError + 7   ' A SQL request has not affected the expected rowcount (ex: one Update do nothing)
    SQLBadRowExpectedCount = vbObjectError + 8   ' A SQL request does not return the expected rowcount : select an item return nothing...
    DrivingError = vbObjectError + 9
    CompFncFailed = vbObjectError + 10           ' when component function fail
    GridLoadFailed = vbObjectError + 11          ' load function failed ... bad sql
    QuietException = vbObjectError + 12          ' do not display error message
    SQLTableReferenceConstraint = vbObjectError + 13 ' A SQL request cannot be executed : Table reference constraint
    DuplicityDetected = vbObjectError + 2301     ' detected row with same unique id
End Enum

Private Enum ArmCusErr
    DuplicityDetected = C_ERRORRAISE + 2301                ' detected row with same unique id
End Enum

Public Event quit()

Public Property Set ArmDb(ByRef ao_Db As Object)
On Error GoTo ErrorHandler

  Set mo_Db = ao_Db
  Exit Property
ErrorHandler:
  Call ErrorHandler("ArmDb.Set")
End Property

Public Property Set Tools(ByRef ao_Tools As Object)
On Error GoTo ErrorHandler

  Set mo_Tools = ao_Tools
  Exit Property
ErrorHandler:
  Call ErrorHandler("Tools.Set")
End Property

Public Property Let Language_Code(as_Language_code As String)
On Error GoTo ErrHandler
  
  ms_Language_Code = as_Language_code
  Exit Property
ErrHandler:
  Call ErrorHandler("Language_Code.Let")
End Property

Public Property Get Language_Code() As String
On Error GoTo ErrHandler
  
  Language_Code = ms_Language_Code
  Exit Property
ErrHandler:
  Call ErrorHandler("Language_Code.Get")
End Property

Property Let COF_Lang(as_Value As String)
On Error GoTo ErrHandler

  ms_COF_Lang = as_Value
  Exit Property
ErrHandler:
  Call ErrorMessage("COF_Lang.Let")
End Property

Public Property Get COF_Lang() As String
On Error GoTo ErrHandler
  
  COF_Lang = ms_COF_Lang
  Exit Property
ErrHandler:
  Call ErrorHandler("COF_Lang.Get")
End Property

Public Property Let U_Code(ByVal al_U_Code As Long)
On Error GoTo ErrorHandler

  ml_U_Code = al_U_Code
  Exit Property
ErrorHandler:
  Call ErrorHandler("U_Code.Let")
End Property

Public Property Let LoginName(ByVal as_Value As String)
On Error GoTo ErrorHandler

  ms_LoginName = as_Value
  Exit Property
ErrorHandler:
  Call ErrorHandler("LoginName.Let")
End Property

Public Property Let Caption(ByVal as_Value As String)
On Error GoTo ErrHandler
    
  ms_Caption = as_Value
  Exit Property
ErrHandler:
  Call ErrorHandler("Caption.Let")
End Property

Public Property Get Caption() As String
On Error GoTo ErrHandler
    
  Caption = ms_Caption
  Exit Property
ErrHandler:
  Call ErrorHandler("Caption.Get")
End Property

Public Property Let Name(ByVal as_Value As String)
On Error GoTo ErrHandler
    
  UserControl.Extender.Name = as_Value
  Exit Property
ErrHandler:
  Call ErrorHandler("Name.Let")
End Property

Public Property Get Name() As String
On Error GoTo ErrHandler
    
  Name = UserControl.Extender.Name
  Exit Property
ErrHandler:
  Call ErrorHandler("Name.Get")
End Property

Public Property Let Tag(ByVal as_Value As String)
On Error GoTo ErrHandler
    
  UserControl.Tag = as_Value
  Exit Property
ErrHandler:
  Call ErrorHandler("Tag.Let")
End Property

Public Property Get Tag() As String
On Error GoTo ErrHandler
    
  Tag = UserControl.Tag
  Exit Property
ErrHandler:
  Call ErrorHandler("Tag.Get")
End Property

Public Property Let Visible(ByVal aVisible As Boolean)
On Error GoTo ErrHandler
    
  UserControl.Extender.Visible = aVisible
  Exit Property
ErrHandler:
  Call ErrorHandler("Visible.Let")
End Property

Public Property Get Visible() As Boolean
On Error GoTo ErrHandler
    
  Visible = UserControl.Extender.Visible
  Exit Property
ErrHandler:
  Call ErrorHandler("Visible.Get")
End Property

Public Property Let Top(ByVal aTop As Single)
On Error GoTo ErrHandler
    
  UserControl.Extender.Top = aTop
  Exit Property
ErrHandler:
  Call ErrorHandler("Top.Let")
End Property

Public Property Get Top() As Single
On Error GoTo ErrHandler
    
  Top = UserControl.Extender.Top
  Exit Property
ErrHandler:
  Call ErrorHandler("Top.Get")
End Property

Public Property Let Height(ByVal aHeight As Single)
On Error GoTo ErrHandler
    
  UserControl.Extender.Height = aHeight
  Exit Property
ErrHandler:
  Call ErrorHandler("Height.Let")
End Property

Public Property Get Height() As Single
On Error GoTo ErrHandler
    
  Height = UserControl.Extender.Height
  Exit Property
ErrHandler:
  Call ErrorHandler("Height.Get")
End Property

Public Property Let Left(ByVal aLeft As Single)
On Error GoTo ErrHandler
    
  UserControl.Extender.Left = aLeft
  Exit Property
ErrHandler:
  Call ErrorHandler("Left.Let")
End Property

Public Property Get Left() As Single
On Error GoTo ErrHandler
    
  Left = UserControl.Extender.Left
  Exit Property
ErrHandler:
  Call ErrorHandler("Left.Get")
End Property

Public Property Let Width(ByVal aWidth As Single)
On Error GoTo ErrHandler
    
  UserControl.Extender.Width = aWidth
  Exit Property
ErrHandler:
  Call ErrorHandler(".Let")
End Property

Public Property Get Width() As Single
On Error GoTo ErrHandler
    
  Width = UserControl.Extender.Width
  Exit Property
ErrHandler:
  Call ErrorHandler("Width.Get")
End Property

Public Sub Move(ByVal aLeft As Single, ByVal aTop As Single, ByVal aWidth As Single, ByVal aHeight As Single)
On Error GoTo ErrHandler
  
  Call UserControl.Extender.Move(aLeft, aTop, aWidth, aHeight)
  Exit Sub
ErrHandler:
  Call ErrorHandler("Move")
End Sub

Public Property Let Enabled(ByVal ab_Value As Boolean)
On Error GoTo ErrHandler

  UserControl.Enabled = ab_Value
  Exit Property
ErrHandler:
  Call ErrorHandler("Enabled.Let")
End Property

Public Property Get Enabled() As Boolean
 On Error GoTo ErrHandler

  Enabled = UserControl.Enabled
  Exit Property
ErrHandler:
  Call ErrorHandler("Enabled.Get")
End Property

Public Sub Zorder()
On Error GoTo ErrHandler

  Call UserControl.Extender.Zorder
  Exit Sub
ErrHandler:
  Call ErrorHandler("Zorder")
End Sub

Public Sub Refresh()
On Error GoTo ErrHandler

  Call UserControl.Refresh
  Exit Sub
ErrHandler:
  Call ErrorHandler("Refresh")
End Sub

Public Property Get hwnd() As Long
On Error GoTo ErrHandler
  
  hwnd = UserControl.hwnd
  Exit Property
ErrHandler:
  Call ErrorHandler("hwnd.Get")
End Property

Public Property Get Initialized() As Boolean
On Error GoTo ErrHandler
    
  Initialized = mb_Initialized
  Exit Property
ErrHandler:
  Call ErrorHandler("Initialized.Get")
End Property

Public Property Let COF_Id(ByVal as_Value As String)
On Error GoTo ErrHandler
  
  mo_PrdConfig.COF_Id = as_Value
  Exit Property
ErrHandler:
  Call ErrorMessage("COF_Id.Let")
End Property

Public Property Get COF_Id() As String
On Error GoTo ErrHandler
  
  COF_Id = mo_PrdConfig.COF_Id
  Exit Property
ErrHandler:
  Call ErrorMessage("COF_Id.Get")
End Property

Public Property Let LEN_Id(ByVal as_Value As Long)
On Error GoTo ErrHandler
  
  mo_PrdConfig.LEN_Id = as_Value
  Exit Property
ErrHandler:
  Call ErrorMessage("LEN_Id.Let")
End Property

Public Property Let CURR_Code(ByVal as_Value As String)
On Error GoTo ErrHandler
  
  mo_PrdConfig.CURR_Code = as_Value
  Exit Property
ErrHandler:
  Call ErrorMessage("CURR_Code.Let")
End Property

Public Property Get CURR_Code() As String
On Error GoTo ErrHandler
  
  CURR_Code = mo_PrdConfig.CURR_Code
  Exit Property
ErrHandler:
  Call ErrorMessage("CURR_Code.Get")
End Property

Public Property Let CT_Code(ByVal as_Value As String)
On Error GoTo ErrHandler
  
  mo_PrdConfig.CT_Code = as_Value
  Exit Property
ErrHandler:
  Call ErrorMessage("CT_Code.Let")
End Property

Public Property Get CT_Code() As String
On Error GoTo ErrHandler
  
  CT_Code = mo_PrdConfig.CT_Code
  Exit Property
ErrHandler:
  Call ErrorMessage("CT_Code.Get")
End Property

Public Property Let OFD_Pos(ByVal al_Value As Long)
On Error GoTo ErrHandler
  
  mo_PrdConfig.OFD_Pos = al_Value
  Exit Property
ErrHandler:
  Call ErrorMessage("OFD_Pos.Let")
End Property

Public Property Get OFD_Pos() As Long
On Error GoTo ErrHandler
  
  OFD_Pos = mo_PrdConfig.OFD_Pos
  Exit Property
ErrHandler:
  Call ErrorMessage("OFD_Pos.Get")
End Property

Public Property Let ValidityDate(ByVal ad_Value As Date)
On Error GoTo ErrHandler
  
  mo_PrdConfig.ValidityDate = ad_Value
  Exit Property
ErrHandler:
  Call ErrorMessage("ValidityDate.Let")
End Property

Public Property Get ValidityDate() As Date
On Error GoTo ErrHandler
  
  ValidityDate = mo_PrdConfig.ValidityDate
  Exit Property
ErrHandler:
  Call ErrorMessage("ValidityDate.Get")
End Property

Public Property Let OFD_WshDat(ByVal ad_Value As Date)
On Error GoTo ErrHandler
  
  mo_PrdConfig.OFD_WshDat = ad_Value
  Exit Property
ErrHandler:
  Call ErrorMessage("OFD_WshDat.Let")
End Property

Public Property Get OFD_WshDat() As Date
On Error GoTo ErrHandler
  
  OFD_WshDat = mo_PrdConfig.OFD_WshDat
  Exit Property
ErrHandler:
  Call ErrorMessage("OFD_WshDat.Get")
End Property

Public Property Let OFD_ShpDat(ByVal ad_Value As Date)
On Error GoTo ErrHandler
  
  mo_PrdConfig.OFD_ShpDat = ad_Value
  Exit Property
ErrHandler:
  Call ErrorMessage("OFD_ShpDat.Let")
End Property

Public Property Get OFD_ShpDat() As Date
On Error GoTo ErrHandler
  
  OFD_ShpDat = mo_PrdConfig.OFD_ShpDat
  Exit Property
ErrHandler:
  Call ErrorMessage("OFD_ShpDat.Get")
End Property

Public Property Let OFD_DelDat(ByVal ad_Value As Date)
On Error GoTo ErrHandler
  
  mo_PrdConfig.OFD_DelDat = ad_Value
  Exit Property
ErrHandler:
  Call ErrorMessage("OFD_DelDat.Let")
End Property

Public Property Get OFD_DelDat() As Date
On Error GoTo ErrHandler
  
  OFD_DelDat = mo_PrdConfig.OFD_DelDat
  Exit Property
ErrHandler:
  Call ErrorMessage("OFD_DelDat.Get")
End Property

Public Property Let IsProduction(ByVal ab_Value As Boolean)
On Error GoTo ErrHandler

  mb_IsProduction = ab_Value
  Exit Property
ErrHandler:
  Call ErrorHandler("IsProduction.Let")
End Property

Public Property Get IsProduction() As Boolean
On Error GoTo ErrHandler

  IsProduction = mb_IsProduction
  Exit Property
ErrHandler:
  Call ErrorHandler("IsProduction.Get")
End Property

Public Property Get IsTemplate() As Boolean
On Error GoTo ErrHandler

  IsTemplate = mo_PrdConfig.IsTemplate
  Exit Property
ErrHandler:
  Call ErrorHandler("IsTemplate.Get")
End Property

Public Property Let IsTemplate(ByVal ab_Value As Boolean)
On Error GoTo ErrHandler

  mo_PrdConfig.IsTemplate = ab_Value
  Exit Property
ErrHandler:
  Call ErrorHandler("IsTemplate.Let")
End Property

Public Property Get IsStandard() As Boolean
On Error GoTo ErrHandler

  IsStandard = mo_PrdConfig.IsStandard
  Exit Property
ErrHandler:
  Call ErrorHandler("IsStandard.Get")
End Property

Public Function Load_A_COM() As Boolean
On Error GoTo ErrHandler
    
Dim la_Columns() As Variant
Dim ll_Idx As Integer
Dim ls_Request As String
Dim ls_Connect() As String

  Load_A_COM = False
  
  If mb_Initialized Then
      Call Err.Raise(ArmErr.CPTAlreadyInitialized)
  End If
  If mo_Db Is Nothing Then
      Call Err.Raise(ArmErr.PropertyNotSet)
  End If
  If mo_Tools Is Nothing Then
      Call Err.Raise(ArmErr.PropertyNotSet)
  End If
  
  mb_InternalInit = True
  
  Call mo_Tools.Load_A_ComControls(UserControl.Controls, mo_Db, ms_Language_Code)
  
  ms_DecimalSeparator = Format(0, ".")
  ms_ThousandSeparator = mo_Tools.GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND)
  mc_Toolbars = 0
  
  Set mo_FSO = CreateObject("Scripting.FileSystemObject")
#If ENV = LIVE Then
  Set mo_Sys = CreateObject("ArmSYSCOM.ArmSys")
  Set mo_DbBaeurer = CreateObject("ArmSYSCOM.ArmDb")
#Else
  Set mo_Sys = New ARMSYSCOMLib.ArmSYS
  Set mo_DbBaeurer = New ARMSYSCOMLib.ArmDb
#End If
  
  Set mo_WshNetwork = CreateObject("WScript.Network")
  ms_ComputerName = mo_WshNetwork.ComputerName
  
  ms_DPCImageCachePath = prg.AppCache_Dir & DPC_IMAGE_CACHE
  btn_Validate.Picture = LoadResPicture(RES_OK, 1)
  btn_Quit.Picture = LoadResPicture(RES_QUIT, 1)
'  btn_ImageQuit.Picture = LoadResPicture(RES_QUIT, 1)
'  btn_PriceMatrixQuit.Picture = LoadResPicture(RES_QUIT, 1)
'  btn_Next.Picture = LoadResPicture(RES_RIGHT, 1)
'  btn_Default.Picture = LoadResPicture(77, 1)
'  btn_Back.Picture = LoadResPicture(RES_LEFT, 1)
'  btn_Image.Picture = LoadResPicture(108, 1)
  btn_Error.Picture = LoadResPicture(146, 1)
  
  Call iml_Icons.ListImages.Clear
  Call iml_Icons.ListImages.Add(, , LoadResPicture("LEVEL1", vbResBitmap))
  Call iml_Icons.ListImages.Add(, , LoadResPicture("LEVEL2", vbResBitmap))
  Call iml_Icons.ListImages.Add(, , LoadResPicture("LEVEL3", vbResBitmap))
  Set cbo_Level.ImageList = iml_Icons
  Call cbo_Level.AddItem(Array(1, "", 1), False)
  Call cbo_Level.AddItem(Array(2, "", 2), False)
  Call cbo_Level.AddItem(Array(3, "", 3), False)
  
  ls_Connect = Split(mo_Tools.GetAConfigData("DPC_BaeurerConnection"), SEP)
  If UBound(ls_Connect) = 5 Then
    ms_BaeurerServer = ls_Connect(0)
    ms_BaeurerDatabase = ls_Connect(1)
    ms_BaeurerLoginName = ls_Connect(2)
    ms_BaeurerPassword = ls_Connect(3)
    ms_BaeurerSource = ls_Connect(4)
    ml_BaeurerFi_Nr = Val(ls_Connect(5))
  Else
      Err.Raise ArmErr.PropertyNotSet, "Split(mo_Tools.GetAConfigData(""DPC_BaeurerConnection"")", "Missing or invalid configuration"
  End If
'  ms_BaeurerSource = "Capture"
'  ms_BaeurerServer = "10.68.16.40\LIVE_SAGE"
'  ms_BaeurerDatabase = "test70"
'  ms_BaeurerLoginName = "test70"
'  ms_BaeurerPassword = "erp"
  
  mv_Edge = Array("C", "D", "E", "F")
  Result = False
  
  mb_InternalInit = True
  
  Set mo_PrdConfig.Tools = mo_Tools
  Set mo_PrdConfig.ArmDb = mo_Db
  mo_PrdConfig.U_Code = ml_U_Code
  mo_PrdConfig.CT_Code = CT_Code
  mo_PrdConfig.CURR_Code = CURR_Code
  mo_PrdConfig.ValidityDate = ValidityDate
  mo_PrdConfig.Language_Code = ms_COF_Lang
  mo_PrdConfig.COF_Id = COF_Id
  mo_PrdConfig.IsProduction = True
  Call mo_PrdConfig.Load_A_COM
  Call mo_PrdConfig.InitOffer
  
  Set mo_PrdTemp.Tools = mo_Tools
  Set mo_PrdTemp.ArmDb = mo_Db
  mo_PrdTemp.U_Code = ml_U_Code
  mo_PrdTemp.CT_Code = CT_Code
  mo_PrdTemp.CURR_Code = CURR_Code
  mo_PrdTemp.ValidityDate = ValidityDate
  mo_PrdTemp.Language_Code = ms_COF_Lang
  mo_PrdTemp.COF_Id = COF_Id
  Call mo_PrdTemp.Load_A_COM

  cal_OFD_WshDat.opening_toward_top = 1
  cal_OFD_ShpDat.opening_toward_top = 1
  cal_OFD_DelDat.opening_toward_top = 1

  For ll_Idx = eDPCSide.esSideC To eDPCSide.esSideF
    Call InitBendingCombo(cbo_Bending(ll_Idx), ll_Idx)
  Next
  
  Call InitPerforationCombo(cbo_Perforation, eDPCCutoutType.eNone)
  Call InitCoatingCombo(cbo_Coating)
  For ll_Idx = 0 To cbo_InlayName.Count - 1
    Call InitInlayCombo(cbo_InlayName(ll_Idx))
    Call InitReferencesCombo(cbo_InlayDelivery(ll_Idx), eDPCReferenceML.rfInlayDeliveryKind)
    Call InitReferencesCombo(cbo_InlayPurchase(ll_Idx), eDPCReferenceML.rfInlayPurchaseType)
  Next

  For ll_Idx = 0 To cbo_Cutout.Count - 1
    Call InitCutoutCombo(cbo_Cutout(ll_Idx))
    Call InitPerforationCombo(cbo_CutPerf(ll_Idx), eDPCCutoutType.eNone)
  Next

  For ll_Idx = 0 To cbo_GSK.Count - 1
    Call InitGasketCombo(cbo_GSK(ll_Idx), eDPCGasketType.gtGasket, 0)
    Call InitGasketCombo(cbo_GSK2(ll_Idx), eDPCGasketType.gtSpacer, 0)
  Next
  
  Call InitVendorCombo(cbo_Vendor)
  Call InitShipPointCombo(cbo_ShipPoint)
  Call InitMaterialCombo
  Call InitGroupCombo(cbo_RPL_AGroup, eDPCGroupType.gtArticleGroup)
  Call InitGroupCombo(cbo_RPL_PGroup, eDPCGroupType.gtProductGroup)
  Call InitGroupCombo(cbo_RPL_OGroup, eDPCGroupType.gtObjectGroup)
  Call InitGroupCombo(cbo_RPL_MGroup, eDPCGroupType.gtGoodsGroup)
  
  grd_File.UnBound = True
  ReDim la_Columns(6) As Variant
  la_Columns(0) = "Idx" & CH_LDELIMIT & "0" & CH_LDELIMIT & "1" & CH_LDELIMIT & "Idx" & CH_LDELIMIT & ""
  la_Columns(1) = "PFI_Id" & CH_LDELIMIT & "0" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PFI_Id" & CH_LDELIMIT & ""
  la_Columns(2) = "PRD_Id" & CH_LDELIMIT & "0" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PRD_Id" & CH_LDELIMIT & ""
  la_Columns(3) = "FIL_Id" & CH_LDELIMIT & "0" & CH_LDELIMIT & "0" & CH_LDELIMIT & "FIL_Id" & CH_LDELIMIT & ""
  la_Columns(4) = "FIL_Name" & CH_LDELIMIT & "2500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "FIL_Name" & CH_LDELIMIT & "#Name"
  la_Columns(5) = "FIL_FileName" & CH_LDELIMIT & "7000" & CH_LDELIMIT & "0" & CH_LDELIMIT & "FIL_FileName" & CH_LDELIMIT & "#File"
  la_Columns(6) = "PFI_Order" & CH_LDELIMIT & "400" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PFI_Order" & CH_LDELIMIT & "#Order"
  Call grd_File.SetColumns(la_Columns)
  
  grd_Attrib.WordWrap = True
  ReDim la_Columns(8) As Variant
  la_Columns(0) = "ATR_Id" & CH_LDELIMIT & "500" & CH_LDELIMIT & "1" & CH_LDELIMIT & "ATR_Id" & CH_LDELIMIT & "#Id"
  la_Columns(1) = "ATR_B2Position" & CH_LDELIMIT & "500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "ATR_B2Position" & CH_LDELIMIT & "#B2 Id"
  la_Columns(2) = "ATR_Name" & CH_LDELIMIT & "1500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "ATR_Name" & CH_LDELIMIT & "#Capture Name"
  la_Columns(3) = "ATR_B7Name" & CH_LDELIMIT & "1500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "ATR_B7Name" & CH_LDELIMIT & "#B7 Name"
  la_Columns(4) = "ATR_Desc" & CH_LDELIMIT & "4500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "ATR_Desc" & CH_LDELIMIT & "#Description"
  la_Columns(5) = "ATR_Value" & CH_LDELIMIT & "4000" & CH_LDELIMIT & "0" & CH_LDELIMIT & "ATR_Value" & CH_LDELIMIT & "#Value" & CH_LDELIMIT & "" & CH_LDELIMIT & "" & CH_LDELIMIT & "RIGHT"
  la_Columns(6) = "ATR_DefaultValue" & CH_LDELIMIT & "0" & CH_LDELIMIT & "0" & CH_LDELIMIT & "ATR_DefaultValue" & CH_LDELIMIT & "" & CH_LDELIMIT & "" & CH_LDELIMIT & "" & CH_LDELIMIT & "RIGHT"
  la_Columns(7) = "ATS_Id" & CH_LDELIMIT & "0" & CH_LDELIMIT & "0" & CH_LDELIMIT & "ATS_Id" & CH_LDELIMIT & ""
  la_Columns(8) = "ATR_RecIdx" & CH_LDELIMIT & "0" & CH_LDELIMIT & "0" & CH_LDELIMIT & "ATR_RecIdx" & CH_LDELIMIT & ""
  Call grd_Attrib.SetColumns(la_Columns)
  grd_Attrib.AllowExcelExport = True

  grd_BOM.UnBound = True
  grd_BOM.AllowSort = False
  ReDim la_Columns(29) As Variant
  la_Columns(0) = "Idx" & CH_LDELIMIT & "0" & CH_LDELIMIT & "1" & CH_LDELIMIT & "Idx" & CH_LDELIMIT & ""
  la_Columns(1) = "BOM_Pos" & CH_LDELIMIT & "500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_Pos" & CH_LDELIMIT & "#Position"
  la_Columns(2) = "BOM_IdentNr" & CH_LDELIMIT & "1000" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_IdentNr" & CH_LDELIMIT & "#Code" & CH_LDELIMIT & "STRING"
  la_Columns(3) = "BOM_Name" & CH_LDELIMIT & "3500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_Name" & CH_LDELIMIT & "#Name" & CH_LDELIMIT & "STRING"
  la_Columns(4) = "BOM_Material" & CH_LDELIMIT & "1000" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_Material" & CH_LDELIMIT & "#Material" & CH_LDELIMIT & "STRING"
  la_Columns(5) = "BOM_Qty" & CH_LDELIMIT & "900" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_Qty" & CH_LDELIMIT & "#Qty" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.000"
  la_Columns(6) = "BOM_QtyTotal" & CH_LDELIMIT & "900" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_QtyTotal" & CH_LDELIMIT & "#Total Qty" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.000"
  la_Columns(7) = "UM_Code" & CH_LDELIMIT & "0" & CH_LDELIMIT & "0" & CH_LDELIMIT & "UM_Code" & CH_LDELIMIT & "#UoM"
  la_Columns(8) = "UM_Name" & CH_LDELIMIT & "400" & CH_LDELIMIT & "0" & CH_LDELIMIT & "UM_Name" & CH_LDELIMIT & "#UoM"
  la_Columns(9) = "BOM_Cost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_Cost" & CH_LDELIMIT & "#Cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(10) = "BOM_SalesPriceUnit" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_SalesPriceUnit" & CH_LDELIMIT & "#Sales unit"
  la_Columns(11) = "BOM_DirectCost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_DirectCost" & CH_LDELIMIT & "#Direct cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.0000"
  la_Columns(12) = "BOM_WasteFactor" & CH_LDELIMIT & "500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_WasteFactor" & CH_LDELIMIT & "#Waste factor" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(13) = "BOM_WasteCost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_WasteCost" & CH_LDELIMIT & "#Waste cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.0000"
  la_Columns(14) = "BOM_RejectFactor" & CH_LDELIMIT & "500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_RejectFactor" & CH_LDELIMIT & "#Reject factor" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(15) = "BOM_RejectCost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_RejectCost" & CH_LDELIMIT & "#Reject cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.0000"
  la_Columns(16) = "BOM_InflFactor" & CH_LDELIMIT & "500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_InflFactor" & CH_LDELIMIT & "#Infl factor" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(17) = "BOM_InflCost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_InflCost" & CH_LDELIMIT & "#Infl cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.0000"
  la_Columns(18) = "CURR_Code" & CH_LDELIMIT & "500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "CURR_Code" & CH_LDELIMIT & "#Currency"
  la_Columns(19) = "BOM_Status" & CH_LDELIMIT & "0" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_Status" & CH_LDELIMIT & ""
  la_Columns(20) = "BOM_StatusDesc" & CH_LDELIMIT & "400" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_StatusDesc" & CH_LDELIMIT & "#Status"
  la_Columns(21) = "BOM_SpecWeight" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_SpecWeight" & CH_LDELIMIT & "#Density" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.000"
  la_Columns(22) = "BOM_Productivity" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_Productivity" & CH_LDELIMIT & "#Productivity" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.000"
  la_Columns(23) = "BOM_CutLength" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_CutLength" & CH_LDELIMIT & "#Cut length" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(24) = "BOM_CutWidth" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_CutWidth" & CH_LDELIMIT & "#Cut width" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(25) = "BOM_BOR_Pos" & CH_LDELIMIT & "500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_BOR_Pos" & CH_LDELIMIT & "#BOR Pos"
  la_Columns(26) = "BOM_Manual" & CH_LDELIMIT & "400" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_Manual" & CH_LDELIMIT & "#Manual"
  la_Columns(27) = "BOM_IdentNrTmp" & CH_LDELIMIT & "1000" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_IdentNrTmp" & CH_LDELIMIT & "#Tmp Nr" & CH_LDELIMIT & "STRING"
  la_Columns(28) = "BOM_Export" & CH_LDELIMIT & "400" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_Export" & CH_LDELIMIT & "#Export"
  la_Columns(29) = "BOM_ExpDat" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOM_ExpDat" & CH_LDELIMIT & "#Export date"
  Call grd_BOM.SetColumns(la_Columns)
  grd_BOM.AllowExcelExport = True
  
  grd_BOR.UnBound = True
  grd_BOR.AllowSort = False
  ReDim la_Columns(34) As Variant
  la_Columns(0) = "Idx" & CH_LDELIMIT & "0" & CH_LDELIMIT & "1" & CH_LDELIMIT & "Idx" & CH_LDELIMIT & ""
  'la_Columns(1) = "PRD_Id" & CH_LDELIMIT & "0" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PRD_Id" & CH_LDELIMIT & ""
  'la_Columns(2) = "OFD_Pos" & CH_LDELIMIT & "500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "OFD_Pos" & CH_LDELIMIT & "#Pos"
  'la_Columns(3) = "PRD_Code" & CH_LDELIMIT & "1100" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PRD_Code" & CH_LDELIMIT & "#BOR Nr"
  'la_Columns(4) = "PRD_Name" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PRD_Name" & CH_LDELIMIT & "#Name"
  la_Columns(1) = "BOR_Pos" & CH_LDELIMIT & "500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_Pos" & CH_LDELIMIT & "#Position"
  la_Columns(2) = "BOR_StagNr" & CH_LDELIMIT & "900" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_StagNr" & CH_LDELIMIT & "#Operation Nr"
  la_Columns(3) = "BOR_Name" & CH_LDELIMIT & "3500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_Name" & CH_LDELIMIT & "#Name" & CH_LDELIMIT & "STRING"
  la_Columns(4) = "BOR_KostSt" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_KostSt" & CH_LDELIMIT & "#Cost place"
  la_Columns(5) = "BOR_Tr" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_Tr" & CH_LDELIMIT & "#Base setup time"
  la_Columns(6) = "BOR_Brtr" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_Brtr" & CH_LDELIMIT & "#Width setup time"
  la_Columns(7) = "BOR_Lgtr" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_Lgtr" & CH_LDELIMIT & "#Length setup time"
  la_Columns(8) = "BOR_Te" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_Te" & CH_LDELIMIT & "#Operation time" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(9) = "BOR_Lgrp" & CH_LDELIMIT & "500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_Lgrp" & CH_LDELIMIT & "#Salary group"
  la_Columns(10) = "BOR_Anz_Bedien" & CH_LDELIMIT & "500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_Anz_Bedien" & CH_LDELIMIT & "#Operator count"
  la_Columns(11) = "BOR_VarMasFact" & CH_LDELIMIT & "1000" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_VarMasFact" & CH_LDELIMIT & "#Var masch. fact" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.000"
  la_Columns(12) = "BOR_VarPerFact" & CH_LDELIMIT & "1000" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_VarPerFact" & CH_LDELIMIT & "#Var pers. fact" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.000"
  la_Columns(13) = "BOR_VarMasCost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_VarMasCost" & CH_LDELIMIT & "#Var masch. cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(14) = "BOR_VarPerCost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_VarPerCost" & CH_LDELIMIT & "#Var pers. cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(15) = "BOR_Teko" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_Teko" & CH_LDELIMIT & "#Outsource cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(16) = "BOR_DirectCost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_DirectCost" & CH_LDELIMIT & "#Direct cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(17) = "BOR_FixMasFact" & CH_LDELIMIT & "1000" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_FixMasFact" & CH_LDELIMIT & "#Fix masch. fact" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.000"
  la_Columns(18) = "BOR_FixMasCost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_FixMasCost" & CH_LDELIMIT & "#Fix. masch. cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(19) = "BOR_WasteFact" & CH_LDELIMIT & "500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_WasteFact" & CH_LDELIMIT & "#Waste fact" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.0"
  la_Columns(20) = "BOR_WasteCost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_WasteCost" & CH_LDELIMIT & "#Waste cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(21) = "BOR_DirectSetupCost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_DirectSetupCost" & CH_LDELIMIT & "#Direct stp cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(22) = "BOR_SubtotalSetupCost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_SubtotalSetupCost" & CH_LDELIMIT & "#Subtot stp cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(23) = "BOR_TotSetupCost" & CH_LDELIMIT & "900" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_TotSetupCost" & CH_LDELIMIT & "#Setup cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(24) = "BOR_DirectWidSetupCost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_DirectWidSetupCost" & CH_LDELIMIT & "#Direct width stp cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(25) = "BOR_SubWidSetupCost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_SubtotalWidSetupCost" & CH_LDELIMIT & "#Subtot width stp cost cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(26) = "BOR_TotWidSetupCost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_TotWidSetupCost" & CH_LDELIMIT & "#Width setup cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(27) = "BOR_DirectLenSetupCost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_DirectLenSetupCost" & CH_LDELIMIT & "#Direct length stp cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(28) = "BOR_SubLenSetupCost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_SubtotalLenSetupCost" & CH_LDELIMIT & "#Subtot length stp cost cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(29) = "BOR_TotLenSetupCost" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_TotLenSetupCost" & CH_LDELIMIT & "#Length setup cost" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
  la_Columns(30) = "CURR_Code" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "CURR_Code" & CH_LDELIMIT & "#Currency"
  la_Columns(31) = "BOR_Status" & CH_LDELIMIT & "0" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_Status" & CH_LDELIMIT & ""
  la_Columns(32) = "BOR_StatusDesc" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_StatusDesc" & CH_LDELIMIT & "#Status"
  la_Columns(33) = "BOR_Manual" & CH_LDELIMIT & "400" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_Manual" & CH_LDELIMIT & "#Manual"
  la_Columns(34) = "BOR_WghPnt" & CH_LDELIMIT & "500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "BOR_WghPnt" & CH_LDELIMIT & "#WghPnt"
  Call grd_BOR.SetColumns(la_Columns)
  grd_BOR.AllowExcelExport = True

  grd_CostCalc.UnBound = True
  grd_CostCalc.AllowSort = False
  ReDim la_Columns(7) As Variant
  la_Columns(0) = "PCC_Code" & CH_LDELIMIT & "0" & CH_LDELIMIT & "1" & CH_LDELIMIT & "PCC_Code" & CH_LDELIMIT & ""
  la_Columns(1) = "RF_Desc" & CH_LDELIMIT & "2500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "RF_Desc" & CH_LDELIMIT & "#Cost"
  la_Columns(2) = "PCC_CostPCS" & CH_LDELIMIT & "1500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PCC_CostPCS" & CH_LDELIMIT & "#Cost/PCR" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.0000"
  la_Columns(3) = "PCC_CostM2" & CH_LDELIMIT & "1500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PCC_CostM2" & CH_LDELIMIT & "#Cost/M2" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.0000"
  la_Columns(4) = "PCC_DirSetupCost" & CH_LDELIMIT & "1500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PCC_DirectSetupCost" & CH_LDELIMIT & "#Direct setup" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.0000"
  la_Columns(5) = "PCC_SubSetupCost" & CH_LDELIMIT & "1500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PCC_SubSetupCost" & CH_LDELIMIT & "#Subtotal setup" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.0000"
  la_Columns(6) = "PCC_TotSetupCost" & CH_LDELIMIT & "1500" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PCC_TotSetupCost" & CH_LDELIMIT & "#Total setup" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.0000"
  la_Columns(7) = "CURR_Code" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "CURR_Code" & CH_LDELIMIT & "#Currency"
  Call grd_CostCalc.SetColumns(la_Columns)
  grd_CostCalc.AllowExcelExport = True
  
'  ReDim la_Columns(24) As Variant
'  la_Columns(0) = "Idx" & CH_LDELIMIT & "0" & CH_LDELIMIT & "1" & CH_LDELIMIT & "Idx" & CH_LDELIMIT & ""
'  la_Columns(1) = "OFD_Pos" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "OFD_Pos" & CH_LDELIMIT & "#Pos"
'  la_Columns(2) = "PRD_Code" & CH_LDELIMIT & "1200" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PRD_Code" & CH_LDELIMIT & "#Code" & CH_LDELIMIT & "STRING"
'  la_Columns(3) = "PRD_Name" & CH_LDELIMIT & "1900" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PRD_Name" & CH_LDELIMIT & "#Name"
'  la_Columns(4) = "OFD_QtyPCS" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "OFD_QtyPCS" & CH_LDELIMIT & "#PanelQty"
'  la_Columns(5) = "UM_NamePCS" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "UM_NamePCS" & CH_LDELIMIT & "UoM"
'  la_Columns(6) = "RPL_PU" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "RPL_PU" & CH_LDELIMIT & "#PU"
'  la_Columns(7) = "PPA_PkgA" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_PkgA" & CH_LDELIMIT & "#PkgA" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.0"
'  la_Columns(8) = "PPA_PkgB" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_PkgB" & CH_LDELIMIT & "#PkgB" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.0"
'  la_Columns(9) = "PPA_PkgH" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_PkgH" & CH_LDELIMIT & "#PkgH" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.0"
'  la_Columns(10) = "PPA_PkgQty" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_PkgQty" & CH_LDELIMIT & "#PkgQty"
'  la_Columns(11) = "PPA_LayQtyA" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_LayQtyA" & CH_LDELIMIT & "#Layer A"
'  la_Columns(12) = "PPA_LayQtyB" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_LayQtyB" & CH_LDELIMIT & "#Layer B"
'  la_Columns(13) = "PPA_LayQtyH" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_LayQtyH" & CH_LDELIMIT & "#Layer H"
'  la_Columns(14) = "PPA_PkgPalQty" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_PkgPalQty" & CH_LDELIMIT & "#Pal/Pkg Qty"
'  la_Columns(15) = "PPA_PalQty" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_PalQty" & CH_LDELIMIT & "#Palette Qty"
'  la_Columns(16) = "PPA_PkgNetWgh" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_PkgNetWgh" & CH_LDELIMIT & "#Pkg netto weight" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
'  la_Columns(17) = "PPA_PalNetWgh" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_PalNetWgh" & CH_LDELIMIT & "#Pal netto weight" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
'  la_Columns(18) = "PPA_PalCode" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_PalCode" & CH_LDELIMIT & "#Palette code"
'  la_Columns(19) = "PPA_PalName" & CH_LDELIMIT & "3000" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_PalName" & CH_LDELIMIT & "#Palette name"
'  la_Columns(20) = "PPA_PalB" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_PalB" & CH_LDELIMIT & "#Palette width"
'  la_Columns(21) = "PPA_CalcPalA" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_CalcPalA" & CH_LDELIMIT & "#Calc. pal.A" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.0"
'  la_Columns(22) = "PPA_CalcPalB" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_CalcPalB" & CH_LDELIMIT & "#Calc. pal.B" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.0"
'  la_Columns(23) = "PPA_CalcPalH" & CH_LDELIMIT & "800" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_CalcPalH" & CH_LDELIMIT & "#Calc. pal.H" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.0"
'  la_Columns(24) = "PPA_VolLoad" & CH_LDELIMIT & "600" & CH_LDELIMIT & "0" & CH_LDELIMIT & "PPA_VolLoad" & CH_LDELIMIT & "#Volumne load" & CH_LDELIMIT & "FLOAT" & CH_LDELIMIT & "0.00"
'  Call grd_Packing.SetColumns(la_Columns)
'  grd_Packing.AllowExcelExport = True
  
  fra_BOMDetail.Visible = False
  fra_BORDetail.Visible = False
  
  ms_Caption = "#Product configuration"
  
  cbo_Coating.Locked = False
  
  Call Resize
  
  Call mo_Tools.LoadToolbars(mo_Db, UserControl.Controls, "DPC", SCREEN_NAME)
  
  'Screen csts
  mc_ScreenLabels = mo_Tools.LoadLabels(mo_Db, UserControl.Controls, Me, SCREEN_NAME, ms_Language_Code)
  Call mo_Tools.ChangeCharset(UserControl.Controls, gl_CodePage, mo_Tools.GetCodePageFromLanguage(mo_Db, ms_COF_Lang))
  
  mo_PrdConfig.lbl_ShipPoint = mo_Tools.GetControl(lbl_Label, "lbl_ShipPoint").Caption
  mo_PrdConfig.lbl_PlantVendor = mo_Tools.GetControl(lbl_Label, "lbl_PlantVendor").Caption
  
  Call tbs_Main_Click
  mb_InternalInit = False
  mb_Initialized = True
  Load_A_COM = mb_Initialized
  Exit Function
ErrHandler:
  mb_InternalInit = False
  Load_A_COM = False
  Call ErrorMessage("Load_A_COM")
End Function

Public Sub Unload_A_COM()
On Error GoTo ErrHandler

  Call mo_PrdConfig.Unload_A_COM
  Call mo_Tools.Unload_A_ComControls(UserControl.Controls)
  Call mo_Db.Close(mc_ScreenLabels)
  Call mo_DbBaeurer.Disconnect
  Set mo_Sys = Nothing
  Set mo_FSO = Nothing
  Set mo_Db = Nothing
  Set mo_DbBaeurer = Nothing
  Exit Sub
ErrHandler:
  Call ErrorMessage("Unload_A_COM")
End Sub

Private Sub InitProductTemplate()
On Error GoTo ErrHandler

Dim lo_Frame As VB.Frame

  
  Call mo_Tools.SetLabelVisible(lbl_Label, "lbl_PanelCodeC", False)
  Call mo_Tools.SetTextVisible(txt_Textbox, "OFD_PosCus", False)
  
  Call mo_Tools.SetLabelVisible(lbl_Label, "lbl_PlantVendor", False)
  cbo_Vendor.Visible = False
  Call mo_Tools.SetLabelVisible(lbl_Label, "lbl_ShipPoint", False)
  cbo_ShipPoint.Visible = False
  chk_ASFlag.Visible = False
  chk_FreeOfCharge.Visible = False
  
  Call mo_Tools.SetLabelVisible(lbl_Label, "lbl_PanelQty", False)
  Call mo_Tools.SetLabelVisible(lbl_Label, "lbl_UM_CodeM2", False)
  Call mo_Tools.SetTextVisible(txt_Textbox, "PanelQtyM2", False)
  Call mo_Tools.SetLabelVisible(lbl_Label, "lbl_UM_CodePCS", False)
  Call mo_Tools.SetTextVisible(txt_Textbox, "PanelQtyPCS", False)
  'Call mo_Tools.SetLabelVisible(lbl_Label, "lbl_QuantityPU", False)
  'Call mo_Tools.SetTextVisible(txt_Textbox, "PanelQtyPU", False)
  
  
  Call mo_Tools.SetLabelVisible(lbl_Label, "lbl_OFD_Pos", False)
  Call mo_Tools.SetTextVisible(txt_Textbox, "OFD_Pos", False)
  
  Call mo_Tools.SetLabelVisible(lbl_Label, "lbl_OFD_DelDat", False)
  cal_OFD_DelDat.Visible = False
  Call mo_Tools.SetLabelVisible(lbl_Label, "lbl_OFD_ShpDat", False)
  cal_OFD_ShpDat.Visible = False
  Call mo_Tools.SetLabelVisible(lbl_Label, "lbl_OFD_WshDat", False)
  cal_OFD_WshDat.Visible = False
  
'  For Each lo_Frame In fra_Price
'    lo_Frame.Visible = False
'  Next
'  fra_PriceSummary.Visible = False
  Exit Sub
ErrHandler:
  Call ErrorHandler("InitProductTemplate")
End Sub

Private Sub InitMaterialCombo()
On Error GoTo ErrHandler
  
Dim ls_Request As String

  ls_Request = "exec DPC_Material_lst2 $COF_Lang$"
  ls_Request = ReplaceCommonPlaceholders(ls_Request)
  cbo_Material.Request = ls_Request
  Exit Sub
ErrHandler:
  Call ErrorHandler("InitMaterialCombo")
End Sub

Private Sub InitGroupCombo(ByVal ao_Combo As ArmCombobox, ByVal ae_GRP_Type As eDPCGroupType)
On Error GoTo ErrHandler
  
Dim ls_req As String

  ls_req = "exec DPC_Group_lst3 $COF_Lang$, $GRP_Type$"
  ls_req = Replace(ls_req, "$GRP_Type$", mo_Tools.SqlInt(ae_GRP_Type), , , vbTextCompare)
  ls_req = ReplaceCommonPlaceholders(ls_req)
  ao_Combo.Request = ls_req
  Exit Sub
ErrHandler:
  Call ErrorHandler("InitGroupCombo")
End Sub

Private Sub InitBendingCombo(ByVal ao_Combo As ArmCombobox, ByVal ae_Side As eDPCSide)
On Error GoTo ErrHandler
  
Dim ls_Request As String

  ls_Request = "exec DPC_Bending_lst $COF_Lang$, $BND_IsShr$, $BND_IsLng$, $BND_IsCus$"
  If (ae_Side = eDPCSide.esSideC) Or (ae_Side = eDPCSide.esSideD) Then
    ls_Request = Replace(ls_Request, "$BND_IsLng$", mo_Tools.SqlBool(True), , , vbTextCompare)
    ls_Request = Replace(ls_Request, "$BND_IsShr$", "NULL", , , vbTextCompare)
  Else
    ls_Request = Replace(ls_Request, "$BND_IsLng$", "NULL", , , vbTextCompare)
    ls_Request = Replace(ls_Request, "$BND_IsShr$", mo_Tools.SqlBool(True), , , vbTextCompare)
  End If
  ls_Request = Replace(ls_Request, "$BND_IsCus$", IIf(IsTemplate, "NULL", mo_Tools.SqlBool(False)), , , vbTextCompare)
  ls_Request = ReplaceCommonPlaceholders(ls_Request)
  ao_Combo.Request = ls_Request
  Exit Sub
ErrHandler:
  Call ErrorHandler("InitBendingCombo")
End Sub

Private Sub InitPerforationCombo(ByVal ao_Combo As ArmCombobox, ByVal ae_CutoutType As eDPCCutoutType)
On Error GoTo ErrHandler
  
Dim ls_Request As String

  ls_Request = "exec DPC_Perforation_lst2 $COF_Lang$, $PRF_AllowVent$, $PRF_AllowLoud$"
  If ae_CutoutType = eDPCCutoutType.eVentilation Then
    ls_Request = Replace(ls_Request, "$PRF_AllowVent$", "X", , , vbTextCompare)
    ls_Request = Replace(ls_Request, "$PRF_AllowLoud$", "NULL", , , vbTextCompare)
  ElseIf ae_CutoutType = eDPCCutoutType.eLoudspeaker Then
    ls_Request = Replace(ls_Request, "$PRF_AllowVent$", "NULL", , , vbTextCompare)
    ls_Request = Replace(ls_Request, "$PRF_AllowLoud$", "X", , , vbTextCompare)
  Else
    ls_Request = Replace(ls_Request, "$PRF_AllowVent$", "NULL", , , vbTextCompare)
    ls_Request = Replace(ls_Request, "$PRF_AllowLoud$", "NULL", , , vbTextCompare)
  End If
  ls_Request = ReplaceCommonPlaceholders(ls_Request)
  ao_Combo.Request = ls_Request
  Exit Sub
ErrHandler:
  Call ErrorHandler("InitPerforationCombo")
End Sub

Private Sub InitReferencesCombo(ByVal ao_Combo As ArmCombobox, ByVal ae_GR_Code As eDPCReferenceML)
On Error GoTo ErrHandler
  
Dim ls_Request As String

  ls_Request = "exec A_References_ML_Lst $GR_Code$, $COF_Lang$"
  ls_Request = Replace(ls_Request, "$GR_Code$", mo_Tools.SqlInt(ae_GR_Code), , , vbTextCompare)
  ls_Request = ReplaceCommonPlaceholders(ls_Request)
  ao_Combo.Request = ls_Request
  Exit Sub
ErrHandler:
  Call ErrorHandler("InitReferencesCombo")
End Sub

Private Sub InitVendorCombo(ByVal ao_Combo As ArmCombobox)
On Error GoTo ErrHandler

  Dim ls_Request As String
  ls_Request = "exec DPC_Vendor_SAP_View_lst $LEN_Id$, $COF_Lang$"
  ls_Request = Replace(ls_Request, "$LEN_Id$", mo_Tools.SqlInt(mo_PrdConfig.LEN_Id), , , vbTextCompare)
  ls_Request = ReplaceCommonPlaceholders(ls_Request)
  ao_Combo.Request = ls_Request
  Exit Sub
ErrHandler:
  Call ErrorHandler("InitVendorCombo")
End Sub

Private Sub InitShipPointCombo(ByVal ao_Combo As ArmCombobox)
On Error GoTo ErrHandler

  Dim ls_Request As String
  ls_Request = "exec DPC_ShipPoint_SAP_View_lst $LEN_Id$, $VEN_Id$, $COF_Lang$"
  ls_Request = Replace(ls_Request, "$LEN_Id$", mo_Tools.SqlInt(mo_PrdConfig.LEN_Id), , , vbTextCompare)
  ls_Request = Replace(ls_Request, "$VEN_Id$", mo_Tools.SqlStr(mo_PrdConfig.VEN_Id), , , vbTextCompare)
  ls_Request = ReplaceCommonPlaceholders(ls_Request)
  ao_Combo.Request = ls_Request
  Exit Sub
ErrHandler:
  Call ErrorHandler("InitShipPointCombo")
End Sub

Private Sub InitCutoutCombo(ByVal ao_Combo As ArmCombobox)
On Error GoTo ErrHandler

  Dim ls_Request As String
  ls_Request = "exec DPC_CutType_cbo $CUT_Type$, $COF_Lang$"
  ls_Request = Replace(ls_Request, "$CUT_Type$", "NULL", , , vbTextCompare)
  ls_Request = ReplaceCommonPlaceholders(ls_Request)
  ao_Combo.Request = ls_Request
  ao_Combo.FirstBlankItem = True
  Exit Sub
ErrHandler:
  Call ErrorHandler("InitCutoutCombo")
End Sub
     
Private Sub InitGasketCombo(ByVal ao_Combo As ArmCombobox, ByVal ae_GSK_Type As eDPCGasketType, ByVal ad_Gap As Double)
On Error GoTo ErrHandler
  
Dim ls_Request As String

  ls_Request = "exec DPC_Gasket_lst2 $GSK_Type$, $GSK_Gap$, $COF_Lang$"
    
  ls_Request = Replace(ls_Request, "$GSK_Type$", mo_Tools.SqlInt(ae_GSK_Type), , , vbTextCompare)
  ls_Request = Replace(ls_Request, "$GSK_Gap$", "NULL", , , vbTextCompare)
  ls_Request = ReplaceCommonPlaceholders(ls_Request)
  ao_Combo.Request = ls_Request
  Exit Sub
ErrHandler:
  Call ErrorHandler("InitMaterialCombo")
End Sub

Private Sub InitInlayCombo(ByVal ao_Combo As ArmCombobox)
On Error GoTo ErrHandler
  
Dim ls_Request As String

  ls_Request = "exec DPC_Inlay_lst $COF_Lang$"
    
  ls_Request = ReplaceCommonPlaceholders(ls_Request)
  ao_Combo.Request = ls_Request
  ao_Combo.FirstBlankItem = True
  ao_Combo.Locked = True
  Exit Sub
ErrHandler:
  Call ErrorHandler("InitInlayCombo")
End Sub

Private Sub InitCoatingCombo(ByVal ao_Combo As ArmCombobox)
On Error GoTo ErrHandler
  
Dim ls_Request As String

  ls_Request = "exec DPC_Coating_cbo $COF_Lang$"
    
  ls_Request = ReplaceCommonPlaceholders(ls_Request)
  ao_Combo.Request = ls_Request
  ao_Combo.Locked = True
  Exit Sub
ErrHandler:
  Call ErrorHandler("InitInlayCombo")
End Sub

Private Sub InitPackingCombo()
On Error GoTo ErrHandler
  
Dim ls_Request As String
    
  ls_Request = "exec DPC_Packing_lst3 $SYS_Id$, $COF_Lang$"
  
  ls_Request = Replace(ls_Request, "$SYS_Id$", mo_Tools.SqlInt(mo_PrdConfig.SYS_Id), , , vbTextCompare)
  ls_Request = ReplaceCommonPlaceholders(ls_Request)
  cbo_Packing.Request = ls_Request
  Exit Sub
ErrHandler:
  Call ErrorHandler("InitPackingCombo")
End Sub

Private Sub LoadPanelPrice()
On Error GoTo ErrHandler

  Call mo_PrdConfig.LoadPanelPrice
  Call DisplayPrice(eDPCScreen.psPanel)
  Exit Sub
ErrHandler:
  Call ErrorHandler("LoadPanelPrice")
End Sub

Private Sub LoadGasketPrice()
On Error GoTo ErrHandler

  Call mo_PrdConfig.LoadGasketPrice
  Call DisplayPrice(eDPCScreen.psGasket)
  Exit Sub
ErrHandler:
  Call ErrorHandler("LoadGasketPrice")
End Sub

Private Sub LoadSpacerPrice()
On Error GoTo ErrHandler

  Call mo_PrdConfig.LoadSpacerPrice
  Call DisplayPrice(eDPCScreen.psGasket)
  Exit Sub
ErrHandler:
  Call ErrorHandler("LoadSpacerPrice")
End Sub

Private Sub LoadPerforationPrice()
On Error GoTo ErrHandler
  
  Call mo_PrdConfig.LoadPerforationPrice
  Call DisplayPrice(eDPCScreen.psPerforation)
  Exit Sub
ErrHandler:
  Call ErrorHandler("LoadPerforationPrice")
End Sub

Private Sub LoadCoatingPrice()
On Error GoTo ErrHandler
  
  Call mo_PrdConfig.LoadCoatingPrice
  Call DisplayPrice(eDPCScreen.psCoating)
  Exit Sub
ErrHandler:
  Call ErrorHandler("LoadCoatingPrice")
End Sub

Private Sub LoadInlayPrice(ByVal ao_Inlay As DPC_Inlay)
On Error GoTo ErrHandler
  
  Call mo_PrdConfig.LoadInlayPrice(ao_Inlay)
  Call DisplayPrice(eDPCScreen.psInlay, , , ao_Inlay)
  Exit Sub
ErrHandler:
  Call ErrorHandler("LoadInlayPrice")
End Sub

Private Sub LoadVentPrice(ByVal ao_Cutout As DPC_Cutout)
On Error GoTo ErrHandler
  
  Call mo_PrdConfig.LoadVentilationPrice(ao_Cutout)
  Call DisplayPrice(eDPCScreen.psVentilation, ao_Cutout)
  Exit Sub
ErrHandler:
  Call ErrorHandler("LoadVentPrice")
End Sub

Private Sub LoadLoudPrice(ByVal ao_Cutout As DPC_Cutout)
On Error GoTo ErrHandler
  
  Call mo_PrdConfig.LoadLoudspeakerPrice(ao_Cutout)
  Call DisplayPrice(eDPCScreen.psLoudspeaker, ao_Cutout)
  Exit Sub
ErrHandler:
  Call ErrorHandler("LoadLoudPrice")
End Sub

Private Sub LoadCutoutPrice(ByVal ao_Cutout As DPC_Cutout)
On Error GoTo ErrHandler
  
  Call mo_PrdConfig.LoadCutoutPrice(ao_Cutout)
  Call DisplayPrice(eDPCScreen.psCutout, ao_Cutout)
  Exit Sub
ErrHandler:
  Call ErrorHandler("LoadCutoutPrice")
End Sub

Private Sub LoadPackingPrice()
On Error GoTo ErrHandler
  
  Call mo_PrdConfig.LoadPackingPrice
  Call DisplayPrice(eDPCScreen.psPacking)
  Exit Sub
ErrHandler:
  Call ErrorHandler("LoadPackingPrice")
End Sub

Private Sub LoadLabelingPrice()
On Error GoTo ErrHandler
  
  Call mo_PrdConfig.LoadLabelingPrice
  Call DisplayPrice(eDPCScreen.psPacking)
  Exit Sub
ErrHandler:
  Call ErrorHandler("LoadLabelingPrice")
End Sub

Private Sub DisplayPanelQtySize()
On Error GoTo ErrHandler

Dim ll_SideIdx As Long
Dim ls_Value As String

  If mo_PrdConfig.PanelQtyM2 > 1 Then
    Call mo_Tools.SetTextBox(txt_Textbox, "PanelQtyM2", mo_Tools.DblToScreen(mo_PrdConfig.PanelQtyM2), Not (mo_PrdConfig.QtyType = eDPCQtyType.qtPCS), Not IsTemplate)
  Else
    Call mo_Tools.SetTextBox(txt_Textbox, "PanelQtyM2", mo_Tools.DblToScreen(mo_PrdConfig.PanelQtyM2, 4), Not (mo_PrdConfig.QtyType = eDPCQtyType.qtPCS), Not IsTemplate)
  End If
  Call mo_Tools.SetTextBox(txt_Textbox, "PanelQtyPCS", mo_Tools.LongToScreen(mo_PrdConfig.PanelQtyPCS), Not (mo_PrdConfig.QtyType = eDPCQtyType.qtM2), Not IsTemplate)
  
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_PU", mo_Tools.LongToScreen(mo_PrdConfig.RPL_PU), (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate)
  
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_ModA", mo_Tools.DblToScreen(mo_PrdConfig.RPL_ModA), (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate)
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_ModB", mo_Tools.DblToScreen(mo_PrdConfig.RPL_ModB), (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate)
  
  ls_Value = IIf(mo_PrdConfig.RPL_PanA >= 0, mo_Tools.DblToScreen(mo_PrdConfig.RPL_PanA), "")
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_PanA", ls_Value, (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate)
  ls_Value = IIf(mo_PrdConfig.RPL_PanB >= 0, mo_Tools.DblToScreen(mo_PrdConfig.RPL_PanB), "")
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_PanB", ls_Value, (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate)
  Call mo_Tools.SetTextBox(txt_Textbox, "PanelSurface", mo_Tools.DblToScreen(mo_PrdConfig.PanelSurface), False)
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayPanelQtySize")
End Sub

Private Sub DisplayPanelMaterial()
On Error GoTo ErrHandler

  
  If mo_PrdConfig.MAT_Id = 0 Then
    Set cbo_Material.SelectedItem = Nothing
  Else
    If Not cbo_Material.SearchItem(mo_PrdConfig.MAT_Id) Then
      Call cbo_Material.AddItem(Array(mo_PrdConfig.MAT_Id, mo_PrdConfig.MAT_Name), True)
    End If
  End If
  cbo_Material.Enabled = (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_Thick", mo_Tools.DblToScreen(mo_PrdConfig.RPL_Thick), (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate)
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_MatTyp", mo_PrdConfig.RPL_MatTyp, (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate)
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayPanelMaterial")
End Sub

Private Sub DisplayPanelData()
On Error GoTo ErrHandler

Dim lsa_PRD_Code() As String
Dim ll_Idx As Long

  Call mo_Tools.SetTextBox(txt_Textbox, "PRD_Name", mo_PrdConfig.PRD_Name, (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate)
  Call mo_Tools.SetTextBox(txt_Textbox, "OFD_Pos", OFD_Pos, False, Not IsTemplate)
  Call mo_Tools.SetTextBox(txt_Textbox, "OFD_PosCus", mo_PrdConfig.OFD_PosCus, True, Not IsTemplate)
  Call mo_Tools.SetTextBox(txt_Textbox, "PRD_Code", mo_PrdConfig.PRD_Code, IsTemplate)
  
  chk_ASFlag.Value = IIf(mo_PrdConfig.OFD_IsAsItem, vbChecked, vbUnchecked)
  chk_ASFlag.Visible = Not IsTemplate
  chk_FreeOfCharge.Value = IIf(mo_PrdConfig.OFD_IsFree, vbChecked, vbUnchecked)
  
  Call InitVendorCombo(cbo_Vendor)
  Call InitShipPointCombo(cbo_ShipPoint)
  If Not cbo_Vendor.SearchItem(mo_PrdConfig.VEN_Id) Then
    Call cbo_Vendor.AddItem(Array(mo_PrdConfig.VEN_Id, mo_PrdConfig.VEN_Name), True)
  End If
  If Not cbo_ShipPoint.SearchItem(mo_PrdConfig.SHP_Id) Then
    Call cbo_ShipPoint.AddItem(Array(mo_PrdConfig.SHP_Id, mo_PrdConfig.SHP_Name), True)
  End If
  
  Call mo_Tools.SetTextBox(txt_Textbox, "PRD_OfferComment", mo_PrdConfig.GetErrorText(eDPCError.erOfferComment, Nothing))
  Call mo_Tools.SetTextBox(txt_Textbox, "PRD_InternalComment", mo_PrdConfig.GetErrorText(eDPCError.erInternalComment, Nothing))
  Call mo_Tools.SetCalendarDate(cal_OFD_WshDat, mo_PrdConfig.OFD_WshDat)
  Call mo_Tools.SetCalendarDate(cal_OFD_ShpDat, mo_PrdConfig.OFD_ShpDat)
  Call mo_Tools.SetCalendarDate(cal_OFD_DelDat, mo_PrdConfig.OFD_DelDat)
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_DrwNr", mo_PrdConfig.RPL_DrwNr, (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate)
  
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_BaeType", mo_Tools.LongToScreen(mo_PrdConfig.RPL_BaeType), (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate)
  'Call mo_Tools.SetTextBox(txt_Textbox, "PanelPerMod", mo_PrdConfig.PanelPerMod, False)
  'Call mo_Tools.SetTextValue(txt_Textbox, "RPL_CorW", mo_Tools.DblToScreen(mo_PrdConfig.RPL_CorW))
  If mo_PrdConfig.LEV_Id = eDPCLevel.lvNone Then
    Set cbo_Level.SelectedItem = Nothing
  Else
    Call cbo_Level.SearchItem(mo_PrdConfig.LEV_Id)
  End If
  cbo_Level.Enabled = Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)
  cmd_Copy.Enabled = Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayPanelData")
End Sub

Private Sub DisplayBending()
On Error GoTo ErrHandler
  
Dim ll_Idx As Long

  chk_RPL_CusDim(0).Value = IIf(mo_PrdConfig.RPL_CustDim And eDPCCoilLock.clCoilWidth, vbChecked, vbUnchecked)
  chk_RPL_CusDim(1).Value = IIf(mo_PrdConfig.RPL_CustDim And eDPCCoilLock.clCoilMinMax, vbChecked, vbUnchecked)
  chk_RPL_CusDim(2).Value = IIf(mo_PrdConfig.RPL_CustDim And eDPCCoilLock.clCutAB, vbChecked, vbUnchecked)
  For ll_Idx = 0 To chk_RPL_CusDim.Count - 1
    chk_RPL_CusDim(ll_Idx).Enabled = (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate
  Next
  
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_CoilW", mo_Tools.DblToScreen(mo_PrdConfig.RPL_CoilW), mo_PrdConfig.RPL_CustDim And eDPCCoilLock.clCoilWidth And (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard) Or IsTemplate))
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_CoWMin", mo_Tools.DblToScreen(mo_PrdConfig.RPL_CoWMin), mo_PrdConfig.RPL_CustDim And eDPCCoilLock.clCoilMinMax And (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate)
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_CoWMax", mo_Tools.DblToScreen(mo_PrdConfig.RPL_CoWMax), mo_PrdConfig.RPL_CustDim And eDPCCoilLock.clCoilMinMax And (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate)
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_CutA", mo_Tools.DblToScreen(mo_PrdConfig.RPL_CutA), mo_PrdConfig.RPL_CustDim And eDPCCoilLock.clCutAB And (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate)
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_CutB", mo_Tools.DblToScreen(mo_PrdConfig.RPL_CutB), mo_PrdConfig.RPL_CustDim And eDPCCoilLock.clCutAB And (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate)
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_NWgh", mo_Tools.DblToScreen(mo_PrdConfig.RPL_NWgh), (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate)
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayBending")
End Sub

Private Sub DisplayBendingSide(ByVal al_SideIdx As Long)
On Error GoTo ErrHandler

  If Not cbo_Bending(al_SideIdx).SearchItem(mo_PrdConfig.BND_Id(al_SideIdx)) Then
    Call cbo_Bending(al_SideIdx).Clear
    If mo_PrdConfig.BND_Id(al_SideIdx) <> "" Then
      Call cbo_Bending(al_SideIdx).AddItem(Array(mo_PrdConfig.BND_Id(al_SideIdx), mo_PrdConfig.BND_Name(al_SideIdx)), True)
    End If
  End If
  
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_H" & mv_Edge(al_SideIdx), mo_Tools.DblToScreen(mo_PrdConfig.RPL_H(al_SideIdx)))
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_S" & mv_Edge(al_SideIdx), mo_Tools.DblToScreen(mo_PrdConfig.RPL_S(al_SideIdx)))
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_SX" & mv_Edge(al_SideIdx), mo_Tools.DblToScreen(mo_PrdConfig.RPL_SX(al_SideIdx)), False)
  
  If (al_SideIdx = eDPCSide.esSideC) Or (al_SideIdx = eDPCSide.esSideD) Then
    chk_RPL_CusDim(3).Value = IIf(mo_PrdConfig.RPL_CustDim And eDPCCoilLock.clBendingUZA, vbChecked, vbUnchecked)
    Call mo_Tools.SetTextBox(txt_Textbox, "RPL_U" & mv_Edge(al_SideIdx), mo_Tools.DblToScreen(mo_PrdConfig.RPL_U(al_SideIdx)), mo_PrdConfig.RPL_CustDim And eDPCCoilLock.clBendingUZA)
  
    Call mo_Tools.SetTextBox(txt_Textbox, "RPL_UMin" & mv_Edge(al_SideIdx), mo_Tools.DblToScreen(mo_PrdConfig.RPL_UMin(al_SideIdx)), (mo_PrdConfig.RPL_CustDim And eDPCCoilLock.clBendingUZA) = 0)
    Call mo_Tools.SetTextBox(txt_Textbox, "RPL_UMax" & mv_Edge(al_SideIdx), mo_Tools.DblToScreen(mo_PrdConfig.RPL_UMax(al_SideIdx)), (mo_PrdConfig.RPL_CustDim And eDPCCoilLock.clBendingUZA) = 0)
  Else
    Call mo_Tools.SetTextBox(txt_Textbox, "RPL_U" & mv_Edge(al_SideIdx), mo_Tools.DblToScreen(mo_PrdConfig.RPL_U(al_SideIdx)))
  End If
  
  'chk_RPL_BVis(al_SideIdx).Value = IIf(mo_PrdConfig.RPL_BVis(al_SideIdx), vbChecked, vbUnchecked)
  'chk_RPL_NClo(al_SideIdx).Value = IIf(mo_PrdConfig.RPL_NClo(al_SideIdx), vbChecked, vbUnchecked)
  
  chk_RPL_BVis(al_SideIdx).Enabled = mo_PrdConfig.BND_CanVi(al_SideIdx) And (Not IsStandard)
  chk_RPL_NClo(al_SideIdx).Enabled = mo_PrdConfig.BND_CanVi(al_SideIdx) And (Not IsStandard)
  chk_RPL_BVis(al_SideIdx).Value = IIf(mo_PrdConfig.RPL_BVis(al_SideIdx), vbChecked, vbUnchecked)
  chk_RPL_NClo(al_SideIdx).Value = IIf(mo_PrdConfig.RPL_NClo(al_SideIdx), vbChecked, vbUnchecked)
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayBendingSide")
End Sub

Private Sub DisplayPrice(Optional ByVal ae_Screen As eDPCScreen = eDPCScreen.psPanelSummary, Optional ao_Cutout As DPC_Cutout = Nothing, Optional ao_SubArt As DPC_SubArt = Nothing, Optional ao_Inlay As DPC_Inlay = Nothing)
On Error GoTo ErrHandler

  Call DisplayPriceVisibility
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayPrice")
End Sub

Private Sub DisplayPriceValidity(ByVal ao_OfferPos As DPC_OfferPos)
On Error GoTo ErrHandler

Dim lo_CheckBox As CheckBox

  Set lo_CheckBox = mo_Tools.GetControl(chk_Price, "chk_" & ao_OfferPos.DOF_Tag)
  If Not lo_CheckBox Is Nothing Then
    lo_CheckBox.Value = IIf(ao_OfferPos.OFD_Valid, vbChecked, vbUnchecked)
    'Call mo_Tools.SetLabelVisible(lbl_Price, "_lbl_CURR_" & ao_OfferPos.DOF_Tag, ao_OfferPos.OFD_Valid)
    'Call mo_Tools.SetTextVisible(txt_Price, "txt_" & ao_OfferPos.DOF_Tag & "_A", ao_OfferPos.OFD_Valid)
    'Call mo_Tools.SetTextVisible(txt_Price, "txt_" & ao_OfferPos.DOF_Tag & "_M", ao_OfferPos.OFD_Valid)
  End If
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayPriceValidity")
End Sub

Private Sub DisplayPriceVisibility()
On Error GoTo ErrHandler

  Dim lo_Offer As DPC_OfferPos
  
  fra_PanelSetupPRF.Visible = mo_PrdConfig.HasPerforation
  fra_PanelSetupUNP.Visible = Not mo_PrdConfig.HasPerforation
  
  For Each lo_Offer In mo_PrdConfig.OfferPrice
    Call DisplayPriceValidity(lo_Offer)
  Next
'  If Not (mo_CurrentInlay Is Nothing) Then
'    For Each lo_Offer In mo_CurrentInlay.OfferPrice
'      Call DisplayPriceValidity(lo_Offer)
'    Next
'  End If
'  If Not (mo_CurrentCutout Is Nothing) Then
'    For Each lo_Offer In mo_CurrentCutout.OfferPrice
'      Call DisplayPriceValidity(lo_Offer)
'    Next
'  End If
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayPriceVisibility")
End Sub

Private Sub DisplayPerforation()
On Error GoTo ErrHandler

  If mo_PrdConfig.PRF_Id = "" Then
    Set cbo_Perforation.SelectedItem = Nothing
  Else
    If Not cbo_Perforation.SearchItem(mo_PrdConfig.PRF_Id) Then
      Call cbo_Perforation.AddItem(Array(mo_PrdConfig.PRF_Id, mo_PrdConfig.PRF_Name), True)
    End If
  End If
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayPerforation")
End Sub

Private Sub DisplayPerforationBorder()
On Error GoTo ErrHandler

Dim ll_SideIdx As Long
Dim ll_Idx As Long

  If mo_PrdConfig.RPL_PBord > 0 Then
    opt_UnperfBorder(mo_PrdConfig.RPL_PBord - 1).Value = True
  Else
    Call mo_Tools.ResetOptionButton(opt_UnperfBorder)
    For ll_Idx = 0 To opt_UnperfBorder.Count - 1
      opt_UnperfBorder(ll_Idx).Enabled = mo_PrdConfig.HasPerforation
    Next
  End If
  
  chk_CorrectStep.Value = IIf(mo_PrdConfig.PRF_IsCorrStep, vbChecked, vbUnchecked)
  chk_CorrectStep.Visible = mo_PrdConfig.HasPerforation
  chk_StandardPerf.Value = IIf(mo_PrdConfig.PRF_IsStandard, vbChecked, vbUnchecked)
  chk_StandardPerf.Enabled = (mo_PrdConfig.RPL_PBord = eDPCPerforationBorderType.pbOther)
  chk_StandardPerf.Visible = mo_PrdConfig.HasPerforation
  
  For ll_SideIdx = eDPCSide.esSideC To eDPCSide.esSideF
    Call mo_Tools.SetTextBox(txt_Textbox, "RPL_UBor" & mv_Edge(ll_SideIdx), mo_Tools.DblToScreen(mo_PrdConfig.RPL_UBor(ll_SideIdx)), False, mo_PrdConfig.HasPerforation)
    Call mo_Tools.SetTextBox(txt_Textbox, "RPL_UBoW" & mv_Edge(ll_SideIdx), mo_Tools.DblToScreen(mo_PrdConfig.RPL_UBoW(ll_SideIdx)), Not mo_PrdConfig.PRF_IsStandard, mo_PrdConfig.HasPerforation)
    chk_PerfBorder(ll_SideIdx).Value = IIf(mo_PrdConfig.RPL_UBoW(ll_SideIdx) >= 0, vbUnchecked, vbChecked)
    chk_PerfBorder(ll_SideIdx).Enabled = (mo_PrdConfig.RPL_PBord = eDPCPerforationBorderType.pbOther)
    chk_PerfBorder(ll_SideIdx).Visible = mo_PrdConfig.HasPerforation
  Next
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayPerforationBorder")
End Sub

Public Sub DisplayGasket()
On Error GoTo ErrHandler
Dim ll_SideIdx As Long

  For ll_SideIdx = eDPCSide.esSideC To eDPCSide.esSideF
    Call DisplayGasketSide(ll_SideIdx)
  Next
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayGasket")
End Sub

Private Sub DisplayGasketSide(ByVal Index As Long)
On Error GoTo ErrHandler

  'chk_Gasket(Index).Visible = (mo_PrdConfig.RPL_Gap(Index) > 0) Or mo_PrdConfig.GTT_Selected(Index)
  If mo_PrdConfig.GTT_Selected(Index) Then
    If mo_PrdConfig.IsGasketOn(Index) Then
      If Not cbo_GSK(Index).SearchItem(mo_PrdConfig.GSK_Id(Index)) Then
        Call cbo_GSK(Index).AddItem(Array(mo_PrdConfig.GSK_Id(Index), mo_PrdConfig.GSK_Name(Index)), True)
      End If
    Else
      Call cbo_GSK(Index).Clear
    End If
    chk_Gasket(Index).Value = vbChecked
    cbo_GSK(Index).Visible = True
  Else
    chk_Gasket(Index).Value = vbUnchecked
    cbo_GSK(Index).Visible = False
  End If
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayGasketSide")
End Sub

Public Sub DisplaySpacer()
On Error GoTo ErrHandler
Dim ll_SideIdx As Long

  For ll_SideIdx = eDPCSide.esSideC To eDPCSide.esSideF
    Call DisplaySpacerSide(ll_SideIdx)
  Next
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplaySpacer")
End Sub

Private Sub DisplaySpacerSide(ByVal Index As Long)
On Error GoTo ErrHandler

  
  'chk_Gasket2(Index).Visible = (mo_PrdConfig.RPL_Gap(Index) > 0) Or mo_PrdConfig.GTT_Selected2(Index)
  If mo_PrdConfig.GTT_Selected2(Index) Then
  
    If mo_PrdConfig.IsSpacerOn(Index) Then
      If Not cbo_GSK2(Index).SearchItem(mo_PrdConfig.GSK_Id2(Index)) Then
        Call cbo_GSK2(Index).AddItem(Array(mo_PrdConfig.GSK_Id2(Index), mo_PrdConfig.GSK_Name2(Index)), True)
      End If
    Else
      Set cbo_GSK2(Index).SelectedItem = Nothing
    End If
    chk_Gasket2(Index).Value = vbChecked
    cbo_GSK2(Index).Visible = True
  Else
    chk_Gasket2(Index).Value = vbUnchecked
    cbo_GSK2(Index).Visible = False
  End If
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplaySpacerSide")
End Sub

Private Sub DisplayCoating()
On Error GoTo ErrHandler


  If Not cbo_Coating.SearchItem(mo_PrdConfig.COA_Id) Then
    Call cbo_Coating.AddItem(Array(mo_PrdConfig.COA_Id, mo_PrdConfig.COA_Name), True)
  End If
  cbo_Coating.Visible = Not mo_PrdConfig.COA_IsCus
  
  Call mo_Tools.SetTextBox(txt_Textbox, "COA_Code", mo_PrdConfig.COA_Code, False)
  Call mo_Tools.SetTextBox(txt_Textbox, "COA_Name", mo_PrdConfig.COA_Name, True, mo_PrdConfig.COA_IsCus)
  Call mo_Tools.SetTextBox(txt_Textbox, "COA_Desc", mo_PrdConfig.COA_Desc, mo_PrdConfig.COA_IsCus)
  
  If mo_PrdConfig.RPL_CoSid = eDPCCoatingExecution.ceUndef Then
    Call mo_Tools.ResetOptionButton(opt_CoatingSide)
  Else
    If (mo_PrdConfig.RPL_CoSid >= eDPCCoatingExecution.ceOneSide) And (mo_PrdConfig.RPL_CoSid <= eDPCCoatingExecution.ceBackSideFull) Then
      opt_CoatingSide(mo_PrdConfig.RPL_CoSid - 1).Value = True
    End If
  End If
  Call mo_Tools.EnableFrame(UserControl.Controls, fra_CoatingSide, mo_PrdConfig.HasCoating)
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayCoating")
End Sub

Private Sub DisplayCutout()
On Error GoTo ErrHandler

Dim lo_Cutout As DPC_Cutout
Dim ll_Idx As Long

  For ll_Idx = 0 To cbo_Cutout.Count - 1
    Set lo_Cutout = mo_PrdConfig.GetCutoutByIndex(ll_Idx)
    Call DisplayCutoutFrame(ll_Idx, lo_Cutout)
  Next
  
  For ll_Idx = 0 To cbo_Cutout.Count - 1
    cbo_Cutout(ll_Idx).Enabled = ll_Idx <= mo_PrdConfig.GetAnyCutoutCount
    If ll_Idx > mo_PrdConfig.GetAnyCutoutCount Then
      cbo_CutPerf(ll_Idx).Enabled = False
    End If
    Call mo_Tools.SetTextEnabled(txt_Textbox, "PCT_SizeDJ" & (ll_Idx + 1), ll_Idx <= mo_PrdConfig.GetAnyCutoutCount)
    Call mo_Tools.SetTextEnabled(txt_Textbox, "PCT_SizeK" & (ll_Idx + 1), ll_Idx <= mo_PrdConfig.GetAnyCutoutCount)
    Call mo_Tools.SetTextEnabled(txt_Textbox, "PCT_SizeL" & (ll_Idx + 1), ll_Idx <= mo_PrdConfig.GetAnyCutoutCount)
    Call mo_Tools.SetTextEnabled(txt_Textbox, "PCT_SizeM" & (ll_Idx + 1), ll_Idx <= mo_PrdConfig.GetAnyCutoutCount)
  Next
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayCutout")
End Sub

Private Sub DisplayCutoutFrame(ByVal al_Idx As Long, ByVal ao_Cutout As DPC_Cutout)
On Error GoTo ErrHandler
  
  If ao_Cutout Is Nothing Then
    Set cbo_Cutout(al_Idx).SelectedItem = Nothing
    Set cbo_CutPerf(al_Idx).SelectedItem = Nothing
    Call mo_Tools.SetTextValue(txt_Textbox, "PCT_SizeDJ" & (al_Idx + 1), "")
    Call mo_Tools.SetTextValue(txt_Textbox, "PCT_SizeK" & (al_Idx + 1), "")
    Call mo_Tools.SetTextValue(txt_Textbox, "PCT_SizeL" & (al_Idx + 1), "")
    Call mo_Tools.SetTextValue(txt_Textbox, "PCT_SizeM" & (al_Idx + 1), "")
  Else
    If Not cbo_Cutout(al_Idx).SearchItem(ao_Cutout.CUT_Id) Then
      Call cbo_Cutout(al_Idx).AddItem(Array(ao_Cutout.CUT_Id, ao_Cutout.CUT_Name), True)
    End If
    
    If (ao_Cutout.PCT_Type = eDPCCutoutType.eCutout) Or (ao_Cutout.PCT_Type = eDPCCutoutType.eNone) Then
      cbo_CutPerf(al_Idx).Enabled = False
    Else
      cbo_CutPerf(al_Idx).Enabled = True
    End If
    
    Call InitPerforationCombo(cbo_CutPerf(al_Idx), ao_Cutout.PCT_Type)
    Call cbo_CutPerf(al_Idx).Clear
    If ao_Cutout.PRF_Id = "" Then
      Set cbo_CutPerf(al_Idx).SelectedItem = Nothing
    Else
      'If Not cbo_CutPerf(al_Idx).SearchItem(ao_Cutout.PRF_Id) Then
      Call cbo_CutPerf(al_Idx).AddItem(Array(ao_Cutout.PRF_Id, ao_Cutout.PRF_Name), True)
      'End If
    End If
    If ao_Cutout.CUT_Shape = eDPCCutoutShape.eRectangular Then
      Call mo_Tools.SetTextValue(txt_Textbox, "PCT_SizeDJ" & (al_Idx + 1), mo_Tools.DblToScreen(ao_Cutout.PCT_SizeJ))
    Else
      Call mo_Tools.SetTextValue(txt_Textbox, "PCT_SizeDJ" & (al_Idx + 1), mo_Tools.DblToScreen(ao_Cutout.PCT_SizeD))
    End If
    Call mo_Tools.SetTextValue(txt_Textbox, "PCT_SizeK" & (al_Idx + 1), mo_Tools.DblToScreen(ao_Cutout.PCT_SizeK))
    Call mo_Tools.SetTextValue(txt_Textbox, "PCT_SizeL" & (al_Idx + 1), mo_Tools.DblToScreen(ao_Cutout.PCT_SizeL))
    Call mo_Tools.SetTextValue(txt_Textbox, "PCT_SizeM" & (al_Idx + 1), mo_Tools.DblToScreen(ao_Cutout.PCT_SizeM))
  End If
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayCutoutFrame")
End Sub

Private Sub DisplayInlay()
On Error GoTo ErrHandler

Dim lo_Inlay As DPC_Inlay
Dim ll_Idx As Long

  For ll_Idx = 0 To cbo_InlayName.Count - 1
    Set lo_Inlay = mo_PrdConfig.GetInlayByIndex(ll_Idx)
    Call DisplayInlayFrame(ll_Idx, lo_Inlay)
  Next
  
  For ll_Idx = 0 To cbo_InlayName.Count - 1
    cbo_InlayName(ll_Idx).Enabled = (ll_Idx <= mo_PrdConfig.GetInlayCount) And (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard))
    Call mo_Tools.SetTextEnabled(txt_Textbox, "INL_Code" & (ll_Idx + 1), ll_Idx <= mo_PrdConfig.GetInlayCount)
    cbo_InlayPurchase(ll_Idx).Enabled = ll_Idx < mo_PrdConfig.GetInlayCount
    cbo_InlayDelivery(ll_Idx).Enabled = ll_Idx < mo_PrdConfig.GetInlayCount
    chk_InlaySetupCharge(ll_Idx).Enabled = ll_Idx < mo_PrdConfig.GetInlayCount
  Next
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayInlay")
End Sub

Private Sub DisplayInlayFrame(ByVal al_Idx As Long, ByVal ao_Inlay As DPC_Inlay)
On Error GoTo ErrHandler

Dim lo_Offer As DPC_OfferPos
 
  If ao_Inlay Is Nothing Then
    Call mo_Tools.SetTextBox(txt_Textbox, "INL_Code" & (al_Idx + 1), "", False)
    Set cbo_InlayName(al_Idx).SelectedItem = Nothing
    Set cbo_InlayPurchase(al_Idx).SelectedItem = Nothing
    Set cbo_InlayDelivery(al_Idx).SelectedItem = Nothing
    chk_InlaySetupCharge(al_Idx).Value = vbUnchecked
    cbo_InlayName(al_Idx).Visible = True
    Call mo_Tools.SetTextBox(txt_Textbox, "INL_Name" & (al_Idx + 1), "", True, False)
  Else
  
    Call mo_Tools.SetTextBox(txt_Textbox, "INL_Code" & (al_Idx + 1), ao_Inlay.INL_Code, False)
    If Not cbo_InlayName(al_Idx).SearchItem(ao_Inlay.INL_Id) Then
        Call cbo_InlayName(al_Idx).AddItem(Array(ao_Inlay.INL_Id, ao_Inlay.INL_Name), True)
    End If
    cbo_InlayName(al_Idx).Visible = Not ao_Inlay.INL_IsCus
    Call mo_Tools.SetTextBox(txt_Textbox, "INL_Name" & (al_Idx + 1), ao_Inlay.INL_Name, True, ao_Inlay.INL_IsCus)
    
    If ao_Inlay.PIN_Purch = 0 Then
      Set cbo_InlayPurchase(al_Idx).SelectedItem = Nothing
    Else
      If Not cbo_InlayPurchase(al_Idx).SearchItem(ao_Inlay.PIN_Purch) Then
        Call cbo_InlayPurchase(al_Idx).AddItem(Array(ao_Inlay.PIN_Purch, ao_Inlay.PIN_PurchDesc), True)
      End If
    End If
    If ao_Inlay.PIN_Deliv = 0 Then
      Set cbo_InlayDelivery(al_Idx).SelectedItem = Nothing
    Else
      If Not cbo_InlayDelivery(al_Idx).SearchItem(ao_Inlay.PIN_Deliv) Then
        Call cbo_InlayDelivery(al_Idx).AddItem(Array(ao_Inlay.PIN_Deliv, ao_Inlay.PIN_DelivDesc), True)
      End If
    End If
    Set lo_Offer = ao_Inlay.GetOfferPos(eDPCOfferDetail.odInlaySetupCharge)
    If Not lo_Offer Is Nothing Then
      chk_InlaySetupCharge(al_Idx).Value = IIf(lo_Offer.OFD_Valid, vbChecked, vbUnchecked)
    End If
  End If
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayInlayFrame")
End Sub

Private Sub DisplayPacking()
On Error GoTo ErrHandler

  Call InitPackingCombo
  If mo_PrdConfig.HasPacking Then
    If Not cbo_Packing.SearchItem(mo_PrdConfig.PKG_Id) Then
      Call cbo_Packing.AddItem(Array(mo_PrdConfig.PKG_Id, mo_PrdConfig.PKG_Name), True)
    End If
  Else
    Set cbo_Packing.SelectedItem = Nothing
  End If
'  chk_SpcPkg.value = IIf(mo_PrdConfig.RPL_SpcPkg = eDPCSpecialPackage.spThermoPalette, vbChecked, vbUnchecked)
'  Call mo_Tools.SetTextValue(txt_Textbox, "RPL_PU_", mo_Tools.DblToScreen(mo_PrdConfig.RPL_PU))
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayPacking")
End Sub

Private Sub DisplayPrdPacking()
On Error GoTo ErrHandler

  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_PkgQty", mo_Tools.LongToScreen(mo_PrdConfig.PPA_PkgQty))
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_PkgA", mo_Tools.DblToScreen(mo_PrdConfig.PPA_PkgA))
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_PkgB", mo_Tools.DblToScreen(mo_PrdConfig.PPA_PkgB))
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_PkgH", mo_Tools.DblToScreen(mo_PrdConfig.PPA_PkgH))
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_PkgNetWgh", mo_Tools.DblToScreen(mo_PrdConfig.PPA_PkgNetWgh), False)
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_PalNetWgh", mo_Tools.DblToScreen(mo_PrdConfig.PPA_PalNetWgh), False)
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_PalCode", mo_PrdConfig.PPA_PalCode)
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_PalName", mo_PrdConfig.PPA_PalName, False)
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_PalQty", mo_Tools.DblToScreen(mo_PrdConfig.PPA_PalQty))
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_PkgPalQty", mo_Tools.LongToScreen(mo_PrdConfig.PPA_PkgPalQty))
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_PalA", mo_Tools.DblToScreen(mo_PrdConfig.PPA_PalA))
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_PalB", mo_Tools.DblToScreen(mo_PrdConfig.PPA_PalB))
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_PalH", mo_Tools.DblToScreen(mo_PrdConfig.PPA_PalH))
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_CalcPalA", mo_Tools.DblToScreen(mo_PrdConfig.PPA_CalcPalA), False)
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_CalcPalB", mo_Tools.DblToScreen(mo_PrdConfig.PPA_CalcPalB), False)
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_CalcPalH", mo_Tools.DblToScreen(mo_PrdConfig.PPA_CalcPalH), False)
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_LayQtyA", mo_Tools.LongToScreen(mo_PrdConfig.PPA_LayQtyA))
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_LayQtyB", mo_Tools.LongToScreen(mo_PrdConfig.PPA_LayQtyB))
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_LayQtyH", mo_Tools.LongToScreen(mo_PrdConfig.PPA_LayQtyH))
  Call mo_Tools.SetTextBox(txt_Textbox, "PPA_VolLoad", mo_Tools.DblToScreen(mo_PrdConfig.PPA_VolLoad), False)
  
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_CodePlan", mo_PrdConfig.RPL_CodePlan, True)
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_MinStockLev", mo_PrdConfig.RPL_MinStockLev, True)
  Call mo_Tools.SetTextBox(txt_Textbox, "RPL_MinPlanQty", mo_PrdConfig.RPL_MinPlanQty, True)
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayPrdPacking")
End Sub

Private Sub FileObjToGrid(ByVal ao_File As DPC_File, ByVal al_Idx As Long)
On Error GoTo ErrHandler

  grd_File.Data(al_Idx, "Idx") = ao_File.Idx
  grd_File.Data(al_Idx, "PFI_Id") = ao_File.PFI_Id
  grd_File.Data(al_Idx, "FIL_Id") = ao_File.FIL_Id
  grd_File.Data(al_Idx, "FIL_Name") = ao_File.FIL_Name
  grd_File.Data(al_Idx, "FIL_FileName") = ao_File.FIL_FileName
  grd_File.Data(al_Idx, "PFI_Order") = ao_File.PFI_Order
  grd_File.Data(al_Idx, "FIL_Ext") = ao_File.FIL_Ext
  Exit Sub
ErrHandler:
  Call ErrorHandler("FileObjToGrid")
End Sub

Private Sub DisplayFile()
On Error GoTo ErrHandler

Dim lo_File As DPC_File

  Call grd_File.ClearGrid
  For Each lo_File In mo_PrdConfig.Files
    If lo_File.RowStatus <> eDPCRowStatus.rsDrop Then
      Call grd_File.AddLine
      Call FileObjToGrid(lo_File, grd_File.Rows - 1)
    End If
  Next
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayFile")
End Sub

Private Sub DisplayData()
On Error GoTo ErrHandler

Dim ll_SideIdx As Long

  Call DisplayPanelData
'  Call DisplayPerimeter
  Call DisplayPanelQtySize
  Call DisplayPanelMaterial
  Call DisplayGasket
  Call DisplaySpacer
  Call DisplayBending
  For ll_SideIdx = eDPCSide.esSideC To eDPCSide.esSideF
    Call DisplayBendingSide(ll_SideIdx)
  Next
  Call DisplayCoating
  Call DisplayInlay
  Call DisplayPerforation
  Call DisplayPerforationBorder

'  Call DisplayVentilation
'  Call DisplayLoudspeaker
  Call DisplayCutout
  Call DisplayPacking
'  Call DisplayLabeling
  Call DisplayFile
  Call DisplayPriceVisibility
  
  If (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard) And (Not IsTemplate) Then
    Call mo_Tools.EnableFrame(UserControl.Controls, fra_Detail(0), False)
    Call mo_Tools.EnableFrame(UserControl.Controls, fra_Detail(7), False)
  End If
  tlb_BOMMain.Enabled = (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate
  tlb_BORMain.Enabled = (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate
  tlb_PackMain.Enabled = (Not (mo_PrdConfig.LEV_Id = eDPCLevel.lvStandard)) Or IsTemplate
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayData")
End Sub

Private Sub DisplayAttrib()
On Error GoTo ErrHandler

Dim ll_RowIdx As Long
Dim ll_RecIdx As Long
Dim ll_ATS_Id As Long
Dim ls_req As String
Dim ls_ATR_Value As String
Dim lo_Inlay As DPC_Inlay
Dim lo_Cutout As DPC_Cutout

  If Not cbo_RPL_PGroup.SearchItem(mo_PrdConfig.RPL_PGroup) Then
    Call cbo_RPL_PGroup.AddItem(Array(mo_PrdConfig.RPL_PGroup, mo_PrdConfig.RPL_PGroupDesc), True)
  End If
  If Not cbo_RPL_AGroup.SearchItem(mo_PrdConfig.RPL_AGroup) Then
    Call cbo_RPL_AGroup.AddItem(Array(mo_PrdConfig.RPL_AGroup, mo_PrdConfig.RPL_AGroupDesc), True)
  End If
  If Not cbo_RPL_MGroup.SearchItem(mo_PrdConfig.RPL_MGroup) Then
    Call cbo_RPL_MGroup.AddItem(Array(mo_PrdConfig.RPL_MGroup, mo_PrdConfig.RPL_MGroupDesc), True)
  End If
  If Not cbo_RPL_OGroup.SearchItem(mo_PrdConfig.RPL_OGroup) Then
    Call cbo_RPL_OGroup.AddItem(Array(mo_PrdConfig.RPL_OGroup, mo_PrdConfig.RPL_OGroupDesc), True)
  End If

  For ll_RowIdx = 1 To DPC_CLASS_COUNT
    Call mo_Tools.SetTextBox(txt_Textbox, "CLS_Name" & ll_RowIdx, mo_PrdConfig.CLS_Name(ll_RowIdx - 1), True)
  Next
  Call mo_Tools.SetTextBox(txt_Textbox, "MAT_CustTariff", mo_PrdConfig.MAT_CustTariff, True)

  ls_req = "exec DPC_AttribXML_lst $ATR_Type$"
  ls_req = Replace(ls_req, "$ATR_Type$", mo_Tools.SqlInt(eDPCXmlExportType.etBae_ArticleMaster), , , vbTextCompare)
  Call grd_Attrib.Load(ls_req, True)
  For ll_RowIdx = 0 To grd_Attrib.Rows - 1
    ls_ATR_Value = grd_Attrib.Data(ll_RowIdx, "ATR_Value")
    If Trim(ls_ATR_Value) = "" Then
      If Left(grd_Attrib.Data(ll_RowIdx, "ATR_DefaultValue"), 1) = "'" And right(grd_Attrib.Data(ll_RowIdx, "ATR_DefaultValue"), 1) = "'" Then
        grd_Attrib.Data(ll_RowIdx, "ATR_Value") = Mid(grd_Attrib.Data(ll_RowIdx, "ATR_DefaultValue"), 2, Len(grd_Attrib.Data(ll_RowIdx, "ATR_DefaultValue")) - 2)
      Else
        grd_Attrib.Data(ll_RowIdx, "ATR_Value") = grd_Attrib.Data(ll_RowIdx, "ATR_DefaultValue")
      End If
    Else
      ll_ATS_Id = grd_Attrib.Data(ll_RowIdx, "ATS_Id")
      ll_RecIdx = grd_Attrib.Data(ll_RowIdx, "ATR_RecIdx")
      If ll_ATS_Id = 4 Then
        grd_Attrib.Data(ll_RowIdx, "ATR_Value") = mo_PrdConfig.ReplaceValuePlaceholder(ls_ATR_Value)
      ElseIf ll_ATS_Id = 5 Then
        If ll_RecIdx > 0 And ll_RecIdx <= mo_PrdConfig.Inlays.Count Then
          Set lo_Inlay = mo_PrdConfig.Inlays(ll_RecIdx)
          grd_Attrib.Data(ll_RowIdx, "ATR_Value") = lo_Inlay.ReplaceValuePlaceholder(ls_ATR_Value)
          Set lo_Inlay = Nothing
        Else
          grd_Attrib.Data(ll_RowIdx, "ATR_Value") = ""
        End If
      ElseIf ll_ATS_Id = 6 Then
        Set lo_Cutout = mo_PrdConfig.GetCutoutByIndex(ll_RecIdx - 1)
        If lo_Cutout Is Nothing Then
          grd_Attrib.Data(ll_RowIdx, "ATR_Value") = ""
        Else
          grd_Attrib.Data(ll_RowIdx, "ATR_Value") = lo_Cutout.ReplaceValuePlaceholder(ls_ATR_Value)
          Set lo_Cutout = Nothing
        End If
      End If
    End If
  Next
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayAttrib")
End Sub

Private Sub DisplayCostCalc()
On Error GoTo ErrHandler

Dim ll_RowIdx As Long
Dim ll_Count As Long

  grd_CostCalc.Redraw = False
  Call grd_CostCalc.ClearGrid
  ll_Count = mo_PrdConfig.GetCostCalcCount
  If ll_Count > 0 Then
    grd_CostCalc.Rows = ll_Count
    For ll_RowIdx = 0 To ll_Count - 1
      Call mo_PrdConfig.CostCalcObjToGrid(ll_RowIdx, grd_CostCalc)
    Next
  End If
  grd_CostCalc.DeselectRow
  grd_CostCalc.Redraw = True
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayCostCalc")
End Sub

Private Sub DisplayPackSummary()
On Error GoTo ErrHandler

'Dim lo_BOM As DPC_BOM
'Dim ld_CostSum As Double
'Dim ld_TotDirectCostSum As Double
'
'  grd_BOM.Redraw = False
'  Call grd_BOM.ClearGrid
'  ld_CostSum = 0
'  ld_TotDirectCostSum = 0
'  For Each lo_BOM In mo_PrdConfig.BOMs
'    If lo_BOM.RowStatus <> eDPCRowStatus.rsDrop Then
'      Call grd_BOM.AddLine
'      Call BOMObjToGrid(lo_BOM, grd_BOM, grd_BOM.Rows - 1)
'      ld_CostSum = ld_CostSum + lo_BOM.BOM_Cost
'      ld_TotDirectCostSum = ld_TotDirectCostSum + lo_BOM.BOM_TotDirectCost
'    End If
'  Next
'  Call grd_BOM.AddLine
'  grd_BOM.Data(grd_BOM.Rows - 1, "BOM_Cost") = mo_Tools.DblToScreen(ld_CostSum)
'  grd_BOM.Data(grd_BOM.Rows - 1, "BOM_TotDirectCost") = mo_Tools.DblToScreen(ld_TotDirectCostSum)
'  grd_BOM.Data(grd_BOM.Rows - 1, "CURR_Code") = "EUR"
'  grd_BOM.LineColor(grd_BOM.Rows - 1) = vbButtonFace
'  grd_BOM.DeselectRow
'  grd_BOM.Redraw = True
'  Call MarkGridRows(grd_BOM, "BOM_IdentNr", DPC_BOM_NEW_IDENTNR, "BOM_Pos", vbYellow)
'  Call MarkGridRows(grd_BOM, "BOM_Status", eDPCBOMBORStatus.boGeneratedError, "BOM_Pos", vbRed)
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayPackSummary")
End Sub

Private Sub DisplayBOM()
On Error GoTo ErrHandler

Dim lo_BOM As DPC_BOM
Dim ld_CostSum As Double
Dim ld_TotDirectCostSum As Double
  
  grd_BOM.Redraw = False
  Call grd_BOM.ClearGrid
  ld_CostSum = 0
  ld_TotDirectCostSum = 0
  For Each lo_BOM In mo_PrdConfig.BOMs
    If lo_BOM.RowStatus <> eDPCRowStatus.rsDrop Then
      Call grd_BOM.AddLine
      Call BOMObjToGrid(lo_BOM, grd_BOM, grd_BOM.Rows - 1)
      ld_CostSum = ld_CostSum + lo_BOM.BOM_Cost
      ld_TotDirectCostSum = ld_TotDirectCostSum + lo_BOM.BOM_TotDirectCost
    End If
  Next
  Call grd_BOM.AddLine
  grd_BOM.Data(grd_BOM.Rows - 1, "BOM_Cost") = mo_Tools.DblToScreen(ld_CostSum)
  grd_BOM.Data(grd_BOM.Rows - 1, "BOM_TotDirectCost") = mo_Tools.DblToScreen(ld_TotDirectCostSum)
  grd_BOM.Data(grd_BOM.Rows - 1, "CURR_Code") = "EUR"
  grd_BOM.LineColor(grd_BOM.Rows - 1) = vbButtonFace
  grd_BOM.DeselectRow
  grd_BOM.Redraw = True
  Call MarkGridRows(grd_BOM, "BOM_IdentNr", DPC_BOM_NEW_IDENTNR, "BOM_Pos", vbYellow)
  Call MarkGridRows(grd_BOM, "BOM_Status", eDPCBOMBORStatus.boGeneratedError, "BOM_Pos", vbRed)
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayBOM")
End Sub

Private Sub DisplayBOR()
On Error GoTo ErrHandler

Dim lo_BOR As DPC_BOR

  grd_BOR.Redraw = False
  Call grd_BOR.ClearGrid
  For Each lo_BOR In mo_PrdConfig.BORs
    If lo_BOR.RowStatus <> eDPCRowStatus.rsDrop Then
      Call grd_BOR.AddLine
      Call BORObjToGrid(lo_BOR, grd_BOR, grd_BOR.Rows - 1)
    End If
  Next
  Call grd_BOR.AddLine
  grd_BOR.Data(grd_BOR.Rows - 1, "CURR_Code") = "EUR"
  grd_BOR.LineColor(grd_BOR.Rows - 1) = vbButtonFace
  grd_BOR.DeselectRow
  grd_BOR.Redraw = True
  Call MarkGridRows(grd_BOR, "BOR_Status", eDPCBOMBORStatus.boGeneratedError, "BOR_Pos", vbRed)
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayBOR")
End Sub

Private Sub DisplayPackFrame(ByVal ao_BOM As DPC_BOM)
On Error GoTo ErrHandler

'  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_Pos", mo_Tools.LongToScreen(ao_BOM.BOM_Pos))
'  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_StatusDesc", ao_BOM.BOM_StatusDesc, False)
'
'
'  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_Identnr", ao_BOM.BOM_IdentNr)
'  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_Name", ao_BOM.BOM_Name)
'
'  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_Material", ao_BOM.BOM_Material, False)
'  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_SalesPriceUnit", mo_Tools.LongToScreen(ao_BOM.BOM_SalesPriceUnit), False)
'
'  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_Qty", mo_Tools.DblToScreen(ao_BOM.BOM_Qty, 3))
'  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_Cost", mo_Tools.DblToScreen(ao_BOM.BOM_Cost))
'  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_UM_Name", ao_BOM.UM_Name, False)
'  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_CURR_Code", ao_BOM.CURR_Code, False)
'
'  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_SpecWeight", mo_Tools.DblToScreen(ao_BOM.BOM_SpecWeight), False)
'  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_Productivity", mo_Tools.DblToScreen(ao_BOM.BOM_Productivity), False)
'  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_CutLength", mo_Tools.DblToScreen(ao_BOM.BOM_CutLength), False)
'  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_CutWidth", mo_Tools.DblToScreen(ao_BOM.BOM_CutWidth), False)
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayPackFrame")
End Sub

Private Sub BOMObjToGrid(ByVal ao_BOM As DPC_BOM, ByVal ao_grid As ArmGrid, ByVal al_Idx As Long)
On Error GoTo ErrHandler

  ao_grid.Data(al_Idx, "Idx") = ao_BOM.Idx
  ao_grid.Data(al_Idx, "BOM_Pos") = ao_BOM.BOM_Pos
  ao_grid.Data(al_Idx, "BOM_IdentNr") = ao_BOM.BOM_IdentNr
  ao_grid.Data(al_Idx, "BOM_Name") = ao_BOM.BOM_Name
  ao_grid.Data(al_Idx, "BOM_Material") = ao_BOM.BOM_Material
  ao_grid.Data(al_Idx, "BOM_Qty") = ao_BOM.BOM_Qty
  ao_grid.Data(al_Idx, "BOM_QtyTotal") = ao_BOM.BOM_Qty * mo_PrdConfig.PanelQtyPCS
  ao_grid.Data(al_Idx, "UM_Code") = ao_BOM.UM_Code
  ao_grid.Data(al_Idx, "UM_Name") = ao_BOM.UM_Name
  ao_grid.Data(al_Idx, "BOM_Cost") = ao_BOM.BOM_Cost
  ao_grid.Data(al_Idx, "BOM_SalesPriceUnit") = ao_BOM.BOM_SalesPriceUnit
  ao_grid.Data(al_Idx, "BOM_DirectCost") = ao_BOM.BOM_DirectCost
  ao_grid.Data(al_Idx, "BOM_WasteFactor") = ao_BOM.BOM_WasteFactor
  ao_grid.Data(al_Idx, "BOM_WasteCost") = ao_BOM.BOM_WasteCost
  ao_grid.Data(al_Idx, "BOM_RejectFactor") = ao_BOM.BOM_RejectFactor
  ao_grid.Data(al_Idx, "BOM_RejectCost") = ao_BOM.BOM_RejectCost
  ao_grid.Data(al_Idx, "BOM_InflFactor") = ao_BOM.BOM_InflFactor
  ao_grid.Data(al_Idx, "BOM_InflCost") = ao_BOM.BOM_InflCost
  ao_grid.Data(al_Idx, "CURR_Code") = ao_BOM.CURR_Code
  ao_grid.Data(al_Idx, "BOM_Status") = ao_BOM.BOM_Status
  ao_grid.Data(al_Idx, "BOM_StatusDesc") = ao_BOM.BOM_StatusDesc
  ao_grid.Data(al_Idx, "BOM_SpecWeight") = ao_BOM.BOM_SpecWeight
  ao_grid.Data(al_Idx, "BOM_Productivity") = ao_BOM.BOM_Productivity
  ao_grid.Data(al_Idx, "BOM_CutLength") = ao_BOM.BOM_CutLength
  ao_grid.Data(al_Idx, "BOM_CutWidth") = ao_BOM.BOM_CutWidth
  ao_grid.Data(al_Idx, "BOM_BOR_Pos") = ao_BOM.BOM_BOR_Pos
  ao_grid.Data(al_Idx, "BOM_Manual") = IIf(ao_BOM.BOM_Manual, "X", "")
  ao_grid.Data(al_Idx, "BOM_IdentNrTmp") = ao_BOM.BOM_IdentNrTmp
  ao_grid.Data(al_Idx, "BOM_Export") = IIf(ao_BOM.BOM_Export, "X", "")
  ao_grid.Data(al_Idx, "BOM_ExpDat") = mo_Tools.DateToScreen(ao_BOM.BOM_ExpDat)
  Exit Sub
ErrHandler:
  Call ErrorHandler("BOMObjToGrid")
End Sub

Private Sub DisplayBOMFrame(ByVal ao_BOM As DPC_BOM)
On Error GoTo ErrHandler

  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_Pos", mo_Tools.LongToScreen(ao_BOM.BOM_Pos))
  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_StatusDesc", ao_BOM.BOM_StatusDesc, False)
  
  
  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_Identnr", ao_BOM.BOM_IdentNr)
  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_Name", ao_BOM.BOM_Name)
  
  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_Material", ao_BOM.BOM_Material, False)
  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_SalesPriceUnit", mo_Tools.LongToScreen(ao_BOM.BOM_SalesPriceUnit), False)
  
  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_Qty", mo_Tools.DblToScreen(ao_BOM.BOM_Qty, 3))
  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_Cost", mo_Tools.DblToScreen(ao_BOM.BOM_Cost))
  'Call mo_Tools.SetTextBox(txt_Textbox, "BOM_TotDirectCost", mo_Tools.DblToScreen(ao_BOM.BOM_TotDirectCost), False)
  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_UM_Name", ao_BOM.UM_Name, False)
  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_CURR_Code", ao_BOM.CURR_Code, False)
  
  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_SpecWeight", mo_Tools.DblToScreen(ao_BOM.BOM_SpecWeight), False)
  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_Productivity", mo_Tools.DblToScreen(ao_BOM.BOM_Productivity), False)
  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_CutLength", mo_Tools.DblToScreen(ao_BOM.BOM_CutLength), False)
  Call mo_Tools.SetTextBox(txt_Textbox, "BOM_CutWidth", mo_Tools.DblToScreen(ao_BOM.BOM_CutWidth), False)
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayBOMFrame")
End Sub

Private Sub UpdateBOMOrder()
On Error GoTo ErrHandler

'Dim ll_RowIdx As Long
'Dim ll_Order As Long
'Dim lo_Inlay As DPC_Inlay
'
'  ll_Order = 0
'  For ll_RowIdx = 0 To grd_Inlay.Rows - 1
'    ll_Order = ll_Order + 1
'    If Val(grd_Inlay.Data(ll_RowIdx, "PIN_Order")) <> ll_Order Then
'      Set lo_Inlay = mo_PrdConfig.GetInlay(grd_Inlay.Data(ll_RowIdx, "Idx"))
'      If Not lo_Inlay Is Nothing Then
'        grd_Inlay.Data(ll_RowIdx, "PIN_Order") = ll_Order
'        lo_Inlay.PIN_Order = ll_Order
'        If lo_Inlay.RowStatus = "" Then
'          lo_Inlay.RowStatus = "U"
'        End If
'      End If
'    End If
'  Next
  Exit Sub
ErrHandler:
  Call ErrorHandler("UpdateBOMOrder")
End Sub

Private Sub BORObjToGrid(ByVal ao_BOR As DPC_BOR, ByVal ao_grid As ArmGrid, ByVal al_Idx As Long)
On Error GoTo ErrHandler

  ao_grid.Data(al_Idx, "Idx") = ao_BOR.Idx
  ao_grid.Data(al_Idx, "BOR_Pos") = ao_BOR.BOR_Pos
  ao_grid.Data(al_Idx, "BOR_StagNr") = ao_BOR.BOR_StagNr
  ao_grid.Data(al_Idx, "BOR_Name") = ao_BOR.BOR_Name
  ao_grid.Data(al_Idx, "BOR_KostSt") = ao_BOR.BOR_KostSt
  ao_grid.Data(al_Idx, "BOR_Tr") = ao_BOR.BOR_Tr
  ao_grid.Data(al_Idx, "BOR_brtr") = ao_BOR.BOR_Brtr
  ao_grid.Data(al_Idx, "BOR_lgtr") = ao_BOR.BOR_Lgtr
  ao_grid.Data(al_Idx, "BOR_te") = ao_BOR.BOR_Te
  ao_grid.Data(al_Idx, "BOR_lgrp") = ao_BOR.BOR_Lgrp
  ao_grid.Data(al_Idx, "BOR_Anz_bedien") = ao_BOR.BOR_Anz_Bedien
  ao_grid.Data(al_Idx, "BOR_VarMasFact") = ao_BOR.BOR_VarMasFact
  ao_grid.Data(al_Idx, "BOR_VarPerFact") = ao_BOR.BOR_VarPerFact
  ao_grid.Data(al_Idx, "BOR_VarMasCost") = ao_BOR.BOR_VarMasCost
  ao_grid.Data(al_Idx, "BOR_VarPerCost") = ao_BOR.BOR_VarPerCost
  
  ao_grid.Data(al_Idx, "BOR_OutsrcCost") = ao_BOR.BOR_OutsrcCost
  
  ao_grid.Data(al_Idx, "BOR_Teko") = ao_BOR.BOR_Teko
  ao_grid.Data(al_Idx, "BOR_DirectCost") = ao_BOR.BOR_DirectCost
  ao_grid.Data(al_Idx, "BOR_FixMasFact") = ao_BOR.BOR_FixMasFact
  ao_grid.Data(al_Idx, "BOR_FixMasCost") = ao_BOR.BOR_FixMasCost
  ao_grid.Data(al_Idx, "BOR_WasteFact") = ao_BOR.BOR_WasteFact
  ao_grid.Data(al_Idx, "BOR_WasteCost") = ao_BOR.BOR_WasteCost
  ao_grid.Data(al_Idx, "BOR_DirectSetupCost") = ao_BOR.BOR_DirectSetupCost
  ao_grid.Data(al_Idx, "BOR_SubtotalSetupCost") = ao_BOR.BOR_SubtotalSetupCost
  ao_grid.Data(al_Idx, "BOR_TotSetupCost") = ao_BOR.BOR_TotSetupCost
  ao_grid.Data(al_Idx, "BOR_DirectWidSetupCost") = ao_BOR.BOR_DirectSetupCost
  ao_grid.Data(al_Idx, "BOR_SubWidSetupCost") = ao_BOR.BOR_SubtotalSetupCost
  ao_grid.Data(al_Idx, "BOR_TotWidSetupCost") = ao_BOR.BOR_TotSetupCost
  ao_grid.Data(al_Idx, "BOR_DirectLenSetupCost") = ao_BOR.BOR_DirectSetupCost
  ao_grid.Data(al_Idx, "BOR_SubLenSetupCost") = ao_BOR.BOR_SubtotalSetupCost
  ao_grid.Data(al_Idx, "BOR_TotLenSetupCost") = ao_BOR.BOR_TotSetupCost
  ao_grid.Data(al_Idx, "CURR_Code") = ao_BOR.CURR_Code
  ao_grid.Data(al_Idx, "BOR_Status") = ao_BOR.BOR_Status
  ao_grid.Data(al_Idx, "BOR_StatusDesc") = ao_BOR.BOR_StatusDesc
  ao_grid.Data(al_Idx, "BOR_Manual") = IIf(ao_BOR.BOR_Manual, "X", "")
  ao_grid.Data(al_Idx, "BOR_WghPnt") = ao_BOR.BOR_WghPnt
  ao_grid.Data(al_Idx, "BOR_Kurzben") = ao_BOR.BOR_Kurzben
  Exit Sub
ErrHandler:
  Call ErrorHandler("BORObjToGrid")
End Sub

Private Sub DisplayBORFrame(ByVal ao_BOR As DPC_BOR)
On Error GoTo ErrHandler

  Call mo_Tools.SetTextBox(txt_Textbox, "BOR_Pos", mo_Tools.LongToScreen(ao_BOR.BOR_Pos))
  
  Call mo_Tools.SetTextBox(txt_Textbox, "BOR_StagNr", ao_BOR.BOR_StagNr)
  Call mo_Tools.SetTextBox(txt_Textbox, "BOR_Name", ao_BOR.BOR_Name)
  
  Call mo_Tools.SetTextBox(txt_Textbox, "BOR_Anz_Bedien", mo_Tools.LongToScreen(ao_BOR.BOR_Anz_Bedien))
  Call mo_Tools.SetTextBox(txt_Textbox, "BOR_Te", mo_Tools.DblToScreen(ao_BOR.BOR_Te))
  Call mo_Tools.SetTextBox(txt_Textbox, "BOR_Tr", mo_Tools.DblToScreen(ao_BOR.BOR_Tr))
  Call mo_Tools.SetTextBox(txt_Textbox, "BOR_Lgtr", mo_Tools.DblToScreen(ao_BOR.BOR_Lgtr))
  Call mo_Tools.SetTextBox(txt_Textbox, "BOR_Brtr", mo_Tools.DblToScreen(ao_BOR.BOR_Brtr))
  Call mo_Tools.SetTextBox(txt_Textbox, "BOR_VarPerFact", mo_Tools.DblToScreen(ao_BOR.BOR_VarPerFact))
  Call mo_Tools.SetTextBox(txt_Textbox, "BOR_WghPnt", mo_Tools.LongToScreen(ao_BOR.BOR_WghPnt))
  
  'Call mo_Tools.SetTextBox(txt_Textbox, "BOR_StatusDesc", ao_BOR.BOR_StatusDesc, False)
  'Call mo_Tools.SetTextBox(txt_Textbox, "BOR_KostSt", mo_Tools.LongToScreen(ao_BOR.BOR_KostSt), False)
  
  
  'Call mo_Tools.SetTextBox(txt_Textbox, "BOR_Lgrp", ao_BOR.BOR_Lgrp, False)
  
  'Call mo_Tools.SetTextBox(txt_Textbox, "BOR_Cost", mo_Tools.DblToScreen(ao_BOR.BOR_Cost))
  'Call mo_Tools.SetTextBox(txt_Textbox, "BOR_TotCost", mo_Tools.DblToScreen(ao_BOR.BOR_TotCost(mo_PrdConfig.PanelQtyPCS)), False)
  'Call mo_Tools.SetTextBox(txt_Textbox, "BOR_CURR_Code", ao_BOR.CURR_Code, False)
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayBORFrame")
End Sub

Private Sub UpdateBOROrder()
On Error GoTo ErrHandler

'Dim ll_RowIdx As Long
'Dim ll_Order As Long
'Dim lo_Inlay As DPC_Inlay
'
'  ll_Order = 0
'  For ll_RowIdx = 0 To grd_Inlay.Rows - 1
'    ll_Order = ll_Order + 1
'    If Val(grd_Inlay.Data(ll_RowIdx, "PIN_Order")) <> ll_Order Then
'      Set lo_Inlay = mo_PrdConfig.GetInlay(grd_Inlay.Data(ll_RowIdx, "Idx"))
'      If Not lo_Inlay Is Nothing Then
'        grd_Inlay.Data(ll_RowIdx, "PIN_Order") = ll_Order
'        lo_Inlay.PIN_Order = ll_Order
'        If lo_Inlay.RowStatus = "" Then
'          lo_Inlay.RowStatus = "U"
'        End If
'      End If
'    End If
'  Next
  Exit Sub
ErrHandler:
  Call ErrorHandler("UpdateBOROrder")
End Sub

Private Sub cal_OFD_WshDat_changeposition(y As Integer)
On Error GoTo ErrHandler
  
  Call cal_OFD_WshDat.Zorder
  cal_OFD_WshDat.Top = cal_OFD_WshDat.Top + y
  Exit Sub
ErrHandler:
  Call ErrorMessage("cal_OFD_WshDat_changeposition")
End Sub

Private Sub cal_OFD_ShpDat_changeposition(y As Integer)
On Error GoTo ErrHandler
  
  Call cal_OFD_ShpDat.Zorder
  cal_OFD_ShpDat.Top = cal_OFD_ShpDat.Top + y
  Exit Sub
ErrHandler:
  Call ErrorMessage("cal_OFD_ShpDat_changeposition")
End Sub

Private Sub cal_OFD_DelDat_changeposition(y As Integer)
On Error GoTo ErrHandler
  
  Call cal_OFD_DelDat.Zorder
  cal_OFD_DelDat.Top = cal_OFD_DelDat.Top + y
  Exit Sub
ErrHandler:
  Call ErrorMessage("cal_OFD_DelDat_changeposition")
End Sub

Private Sub cal_OFD_WshDat_datechangee()
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  mo_PrdConfig.OFD_WshDat = cal_OFD_WshDat.date_dt
  Exit Sub
ErrHandler:
  Call ErrorMessage("cal_OFD_WshDat_datechangee")
End Sub

Private Sub cal_OFD_ShpDat_datechangee()
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  mo_PrdConfig.OFD_ShpDat = cal_OFD_ShpDat.date_dt
  Exit Sub
ErrHandler:
  Call ErrorMessage("cal_OFD_ShpDat_datechangee")
End Sub

Private Sub cal_OFD_DelDat_datechangee()
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  mo_PrdConfig.OFD_DelDat = cal_OFD_DelDat.date_dt
  Exit Sub
ErrHandler:
  Call ErrorMessage("cal_OFD_DelDat_datechangee")
End Sub

Private Sub cbo_Bending_ComboItemSelected(Index As Integer)
On Error GoTo ErrHandler
  
  If mb_InternalInit Then Exit Sub
  
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  Call mo_PrdConfig.LoadBending(Index, mo_Tools.GetComboKey(cbo_Bending(Index)))
  Call mo_PrdConfig.SetStandardPanelUZS(Index)
  If (Index = eDPCSide.esSideC) Or (Index = eDPCSide.esSideD) Then
    Call mo_PrdConfig.LoadThicknessHeight(True, False, False)
  Else
    Call mo_PrdConfig.LoadThicknessHeight(False, True, False)
  End If
  'Call mo_PrdConfig.CalculateCoWMinMax
  'Call mo_PrdConfig.CalculateCutAB
  Call DisplayBendingSide(Index)
  Call DisplayBending
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_Bending_ComboItemSelected")
End Sub

Private Sub cbo_Coating_ComboItemSelected()
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  Call mo_PrdConfig.LoadCoating(mo_Tools.GetComboKey(cbo_Coating))
  If mo_PrdConfig.HasCoating Then
    If mo_PrdConfig.RPL_CoSid = eDPCCoatingExecution.ceUndef Then
      mo_PrdConfig.RPL_CoSid = eDPCCoatingExecution.ceOneSide
    End If
  Else
    mo_PrdConfig.RPL_CoSid = eDPCCoatingExecution.ceUndef
  End If
  Call DisplayCoating
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_Coating_ComboItemSelected")
End Sub

'Private Function GetCutout(ByVal al_Index As Long) As DPC_Cutout
'On Error GoTo ErrHandler
'
'Dim lo_Cutout As DPC_Cutout
'Dim ll_Counter As Long
'
'  If mo_PrdConfig.GetAnyCutoutCount > al_Index Then
'    ll_Counter = 0
'    For Each lo_Cutout In mo_PrdConfig.Cutouts
'      If lo_Cutout.RowStatus <> eDPCRowStatus.rsDrop Then
'        If ll_Counter = al_Index Then
'          Call mo_PrdConfig.CutoutUpdate(lo_Cutout)
'          Set GetCutout = lo_Cutout
'          Exit Function
'        End If
'        ll_Counter = ll_Counter + 1
'      End If
'    Next
'    Set lo_Cutout = Nothing
'  Else
'    Set lo_Cutout = Nothing
'  End If
'  Set GetCutout = lo_Cutout
'  Exit Function
'ErrHandler:
'  Call errorHandler("GetCutout")
'End Function

Private Sub cbo_Cutout_ComboItemSelected(Index As Integer)
On Error GoTo ErrHandler

Dim lo_Cutout As DPC_Cutout
Dim ls_CUT_Type As String

  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  If mo_Tools.GetComboKey(cbo_Cutout(Index)) = "" Then
    Set lo_Cutout = mo_PrdConfig.GetCutoutByIndex(Index)
    If Not lo_Cutout Is Nothing Then
      Call mo_PrdConfig.CutoutDrop(lo_Cutout)
    End If
  Else
    Set lo_Cutout = mo_PrdConfig.GetCutoutByIndex(Index)
    If lo_Cutout Is Nothing Then
      ls_CUT_Type = Left(mo_Tools.GetComboKey(cbo_Cutout(Index)), 3)
      Set lo_Cutout = New DPC_Cutout
      If StrComp(ls_CUT_Type, "CUT", vbTextCompare) = 0 Then
        Call mo_PrdConfig.InitCutout(lo_Cutout, eDPCCutoutType.eCutout, eDPCRowStatus.rsAdd)
      ElseIf StrComp(ls_CUT_Type, "VET", vbTextCompare) = 0 Then
        Call mo_PrdConfig.InitCutout(lo_Cutout, eDPCCutoutType.eVentilation, eDPCRowStatus.rsAdd)
      ElseIf StrComp(ls_CUT_Type, "LSP", vbTextCompare) = 0 Then
        Call mo_PrdConfig.InitCutout(lo_Cutout, eDPCCutoutType.eLoudspeaker, eDPCRowStatus.rsAdd)
      Else
        Err.Raise ArmErr.InvalidArgument, "CUT_Id", "Invalid cutout type: " & mo_Tools.GetComboKey(cbo_Cutout(Index))
      End If
      Call lo_Cutout.LoadCutType(mo_Tools.GetComboKey(cbo_Cutout(Index)))
      Call mo_PrdConfig.CutoutAdd(lo_Cutout)
    Else
      Call lo_Cutout.LoadCutType(mo_Tools.GetComboKey(cbo_Cutout(Index)))
      Call mo_PrdConfig.CutoutUpdate(lo_Cutout)
    End If
  End If
  Set lo_Cutout = Nothing
  Call DisplayCutout
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_Cutout_ComboItemSelected")
End Sub

Private Sub cbo_CutPerf_ComboItemSelected(Index As Integer)
On Error GoTo ErrHandler

Dim lo_Cutout As DPC_Cutout

  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  Set lo_Cutout = mo_PrdConfig.GetCutoutByIndex(Index)
  If Not lo_Cutout Is Nothing Then
    lo_Cutout.PRF_Id = mo_Tools.GetComboKey(cbo_CutPerf(Index))
    lo_Cutout.PRF_Name = cbo_CutPerf(Index).Text
    Call mo_PrdConfig.CutoutUpdate(lo_Cutout)
  End If
  Set lo_Cutout = Nothing
  Call DisplayCutout
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_CutPerf_ComboItemSelected")
End Sub


'Private Function GetInlay(ByVal al_Index As Long) As DPC_Inlay
'On Error GoTo ErrHandler
'
'Dim lo_Inlay As DPC_Inlay
'Dim ll_Counter As Long
'
'  If mo_PrdConfig.GetInlayCount > al_Index Then
'    ll_Counter = 0
'    For Each lo_Inlay In mo_PrdConfig.Inlays
'      If lo_Inlay.RowStatus <> eDPCRowStatus.rsDrop Then
'        If ll_Counter = al_Index Then
'          Call mo_PrdConfig.InlayUpdate(lo_Inlay)
'          Set GetInlay = lo_Inlay
'          Exit Function
'        End If
'        ll_Counter = ll_Counter + 1
'      End If
'    Next
'    Set lo_Inlay = Nothing
'  Else
'    Set lo_Inlay = New DPC_Inlay
'    Call mo_PrdConfig.InitInlay(lo_Inlay, eDPCRowStatus.rsAdd)
'    Call mo_PrdConfig.InlayAdd(lo_Inlay)
'  End If
'  Set GetInlay = lo_Inlay
'  Exit Function
'ErrHandler:
'  Call errorHandler("GetInlay")
'End Function

Private Sub cbo_InlayName_ComboItemSelected(Index As Integer)
On Error GoTo ErrHandler

Dim lo_Inlay As DPC_Inlay

  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  If cbo_InlayName(Index).Text = "" Then
    Set lo_Inlay = mo_PrdConfig.GetInlayByIndex(Index)
    If Not lo_Inlay Is Nothing Then
      Call mo_PrdConfig.InlayDrop(lo_Inlay)
    End If
  Else
    Set lo_Inlay = mo_PrdConfig.GetInlayByIndex(Index)
    If lo_Inlay Is Nothing Then
      Set lo_Inlay = New DPC_Inlay
      Call mo_PrdConfig.InitInlay(lo_Inlay, eDPCRowStatus.rsAdd)
      Call mo_PrdConfig.InlayAdd(lo_Inlay)
    Else
      'Call mo_PrdConfig.SetErrorText(eDPCError.erInlayName, cbo_InlayName(Index).Text, lo_Inlay)
      'Call mo_PrdConfig.SetErrorText(eDPCError.erInlayName, cbo_InlayName(Index).Text, lo_Inlay)
      Call mo_PrdConfig.InlayUpdate(lo_Inlay)
    End If
    Call lo_Inlay.LoadInlay(mo_Tools.GetComboKey(cbo_InlayName(Index)))
    Call lo_Inlay.CalcInlaySize(mo_PrdConfig)
  End If
  Set lo_Inlay = Nothing
  Call DisplayInlay
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_InlayName_ComboItemSelected")
End Sub

Private Sub cbo_InlayDelivery_ComboItemSelected(Index As Integer)
On Error GoTo ErrHandler

Dim lo_Inlay As DPC_Inlay
  
  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  Set lo_Inlay = mo_PrdConfig.GetInlayByIndex(Index)
  If Not lo_Inlay Is Nothing Then
    lo_Inlay.PIN_Deliv = mo_Tools.GetComboKey(cbo_InlayDelivery(Index))
    lo_Inlay.PIN_DelivDesc = cbo_InlayDelivery(Index).Text
    Call mo_PrdConfig.InlayUpdate(lo_Inlay)
  End If
  Call DisplayInlay
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_InlayDelivery_ComboItemSelected")
End Sub

Private Sub cbo_InlayPurchase_ComboItemSelected(Index As Integer)
On Error GoTo ErrHandler

Dim lo_Inlay As DPC_Inlay
  
  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  Set lo_Inlay = mo_PrdConfig.GetInlayByIndex(Index)
  If Not lo_Inlay Is Nothing Then
    lo_Inlay.PIN_Purch = mo_Tools.GetComboKey(cbo_InlayPurchase(Index))
    lo_Inlay.PIN_PurchDesc = cbo_InlayPurchase(Index).Text
    Call mo_PrdConfig.InlayUpdate(lo_Inlay)
  End If
  Call DisplayInlay
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_InlayPurchase_ComboItemSelected")
End Sub

Private Sub cbo_RPL_AGroup_ComboItemSelected()
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  mo_PrdConfig.RPL_AGroup = Val(mo_Tools.GetComboKey(cbo_RPL_AGroup))
  mo_PrdConfig.RPL_AGroupDesc = cbo_RPL_AGroup.Text
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_RPL_AGroup_ComboItemSelected")
End Sub

Private Sub cbo_RPL_PGroup_ComboItemSelected()
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  mo_PrdConfig.RPL_PGroup = mo_Tools.GetComboKey(cbo_RPL_PGroup)
  mo_PrdConfig.RPL_PGroupDesc = cbo_RPL_PGroup.Text
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_RPL_PGroup_ComboItemSelected")
End Sub

Private Sub cbo_RPL_MGroup_ComboItemSelected()
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  mo_PrdConfig.RPL_MGroup = Val(mo_Tools.GetComboKey(cbo_RPL_MGroup))
  mo_PrdConfig.RPL_MGroupDesc = cbo_RPL_MGroup.Text
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_RPL_MGroup_ComboItemSelected")
End Sub

Private Sub cbo_RPL_OGroup_ComboItemSelected()
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  mo_PrdConfig.RPL_OGroup = mo_Tools.GetComboKey(cbo_RPL_OGroup)
  mo_PrdConfig.RPL_OGroupDesc = cbo_RPL_OGroup.Text
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_RPL_OGroup_ComboItemSelected")
End Sub

Private Sub cbo_Vendor_ComboItemSelected()
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  mo_PrdConfig.VEN_Id = mo_Tools.GetComboKey(cbo_Vendor)
  mo_PrdConfig.VEN_Name = cbo_Vendor.Text
  Call cbo_ShipPoint.Clear
  mo_PrdConfig.SHP_Id = 0
  mo_PrdConfig.SHP_Name = ""
  Call InitShipPointCombo(cbo_ShipPoint)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_Vendor_ComboItemSelected")
End Sub

Private Sub cbo_ShipPoint_ComboItemSelected()
On Error GoTo ErrHandler
  
  If mb_InternalInit Then Exit Sub
  mo_PrdConfig.SHP_Id = mo_Tools.GetComboKey(cbo_ShipPoint)
  mo_PrdConfig.SHP_Name = cbo_ShipPoint.Text
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_ShipPoint_ComboItemSelected")
End Sub

Private Sub cbo_Material_ComboItemSelected()
On Error GoTo ErrHandler

Dim ls_Request As String
  
  If mb_InternalInit Then Exit Sub
  
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  mo_PrdConfig.RPL_Thick = 0
  mo_PrdConfig.RPL_MatTyp = ""
  Call mo_PrdConfig.LoadMaterial(mo_Tools.GetComboKey(cbo_Material))
  Call DisplayPanelMaterial
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_Material_ComboItemSelected")
End Sub

Private Sub cbo_Level_ComboItemSelected()
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  mo_PrdConfig.LEV_Id = mo_Tools.GetComboKey(cbo_Level)
  Call mo_PrdConfig.InitCostParameters
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_Level_ComboItemSelected")
End Sub

Private Sub cmd_PrdPacking_Click()
On Error GoTo ErrHandler

  Dim lo_BOM As DPC_BOM

  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  If mo_Tools.ReconnectSafe(mo_DbBaeurer, ms_BaeurerServer, ms_BaeurerDatabase, ms_BaeurerLoginName, ms_BaeurerPassword, ms_BaeurerSource) Then
    Set lo_BOM = SelectRawMaterial(eDPCBOMMaterial.bcPacking, False)
    If Not lo_BOM Is Nothing Then
      Call mo_PrdConfig.LoadPrdPackingBOM(lo_BOM)
      Call mo_PrdConfig.CalcPrdPacking
      Call DisplayPrdPacking
    End If
  End If
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cmd_PrdPacking_Click")
End Sub

Private Sub UpdatePrdPackingIdentNr(ByVal as_IdentNr As String)
On Error GoTo ErrHandler

Dim lo_ErrCollection As New Collection
Dim lo_BOM As DPC_BOM
  
  
  If mo_Tools.ReconnectSafe(mo_DbBaeurer, ms_BaeurerServer, ms_BaeurerDatabase, ms_BaeurerLoginName, ms_BaeurerPassword, ms_BaeurerSource) Then
    Set lo_BOM = New DPC_BOM
    Set lo_BOM.Tools = mo_Tools
    Call lo_BOM.Clear
    If Trim(as_IdentNr) <> "" Then
      If lo_BOM.LoadBOMFromBaeurer(mo_Db, mo_DbBaeurer, ms_Language_Code, as_IdentNr) Then
        mo_PrdConfig.PPA_PalCode = lo_BOM.BOM_IdentNr
        mo_PrdConfig.PPA_PalName = lo_BOM.BOM_Name
      Else
        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9854, "#Material definition couldn't be loaded from Baeurer")
      End If
    End If
    Set lo_BOM = Nothing
  End If
  Exit Sub
ErrHandler:
  Call ErrorHandler("UpdatePrdPackingIdentNr")
End Sub

Private Sub chk_RPL_BVis_Click(Index As Integer)
On Error GoTo ErrHandler

Dim ll_Idx As Long

  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  If mo_PrdConfig.BND_CanVi(Index) Then
    mo_PrdConfig.RPL_BVis(Index) = (chk_RPL_BVis(Index).Value = vbChecked)
    If mo_PrdConfig.RPL_BVis(Index) Then mo_PrdConfig.RPL_NClo(Index) = True
    For ll_Idx = eDPCSide.esSideC To eDPCSide.esSideF
      Call DisplayBendingSide(ll_Idx)
    Next
  Else
    chk_RPL_BVis(Index).Value = vbUnchecked
  End If
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("chk_RPL_BVis_Click")
End Sub

Private Sub chk_RPL_NClo_Click(Index As Integer)
On Error GoTo ErrHandler
  
Dim ll_Idx As Long

  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  If mo_PrdConfig.BND_CanVi(Index) Then
    mo_PrdConfig.RPL_NClo(Index) = (chk_RPL_NClo(Index).Value = vbChecked)
    If Not mo_PrdConfig.RPL_NClo(Index) Then mo_PrdConfig.RPL_BVis(Index) = False
    For ll_Idx = eDPCSide.esSideC To eDPCSide.esSideF
      Call DisplayBendingSide(ll_Idx)
    Next
  Else
    chk_RPL_NClo(Index).Value = vbUnchecked
  End If
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("chk_RPL_NClo_Click")
End Sub

Private Sub chk_RPL_CusDim_Click(Index As Integer)
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  If chk_RPL_CusDim(Index).Value = vbChecked Then
    mo_PrdConfig.RPL_CustDim = mo_PrdConfig.RPL_CustDim Or (2 ^ Index)
  Else
    mo_PrdConfig.RPL_CustDim = mo_PrdConfig.RPL_CustDim And (Not (2 ^ Index))
  End If
  If (2 ^ Index) = eDPCCoilLock.clBendingUZA Then
    If chk_RPL_CusDim(Index).Value = vbChecked Then
      mo_PrdConfig.RPL_U(eDPCSide.esSideC) = 0
      mo_PrdConfig.RPL_U(eDPCSide.esSideD) = 0
    Else
      mo_PrdConfig.RPL_UMin(eDPCSide.esSideC) = mo_PrdConfig.BND_UMin(eDPCSide.esSideC)
      mo_PrdConfig.RPL_UMin(eDPCSide.esSideD) = mo_PrdConfig.BND_UMin(eDPCSide.esSideD)
      mo_PrdConfig.RPL_UMax(eDPCSide.esSideC) = mo_PrdConfig.BND_UMax(eDPCSide.esSideC)
      mo_PrdConfig.RPL_UMax(eDPCSide.esSideD) = mo_PrdConfig.BND_UMax(eDPCSide.esSideD)
      mo_PrdConfig.RPL_U(eDPCSide.esSideC) = 0
      mo_PrdConfig.RPL_U(eDPCSide.esSideD) = 0
    End If
  End If
  Call DisplayBending
  Call DisplayBendingSide(eDPCSide.esSideC)
  Call DisplayBendingSide(eDPCSide.esSideD)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("chk_RPL_CusDim_Click")
End Sub

'Private Function GetSideIndex(ByVal as_Side As String) As eDPCSide
'On Error GoTo ErrHandler
'
'  Dim le_SideIdx As eDPCSide
'
'  GetSideIndex = -1
'  For le_SideIdx = eDPCSide.esSideC To eDPCSide.esSideF
'    If StrComp(as_Side, mv_Edge(le_SideIdx), vbTextCompare) = 0 Then
'      GetSideIndex = le_SideIdx
'      Exit For
'    End If
'  Next
'  Exit Function
'ErrHandler:
'  Call ErrorHandler("GetSideIndex")
'End Function

Private Sub cbo_GSK_ComboItemSelected(Index As Integer)
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  Call mo_PrdConfig.LoadGasket(eDPCGasketType.gtGasket, Index, mo_Tools.GetComboKey(cbo_GSK(Index)))
  
  Call mo_PrdConfig.UpdateGap(eDPCGasketType.gtGasket, Index)
  Call DisplayGasket
  Call DisplayPanelQtySize
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_GSK_ComboItemSelected")
End Sub

Private Sub cbo_GSK2_ComboItemSelected(Index As Integer)
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  Call mo_PrdConfig.LoadGasket(eDPCGasketType.gtSpacer, Index, mo_Tools.GetComboKey(cbo_GSK2(Index)))
  Call mo_PrdConfig.UpdateGap(eDPCGasketType.gtSpacer, Index)
  Call DisplaySpacer
  Call DisplayPanelQtySize
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_GSK2_ComboItemSelected")
End Sub

Private Function SelectRawMaterial(ByVal ae_Categ As eDPCBOMMaterial, ByVal ab_EnableFilter As Boolean) As DPC_BOM
On Error GoTo ErrHandler

Dim lo_frmDPC_BOM As frmDPC_BOM
Dim lo_BOM As DPC_BOM

  Set SelectRawMaterial = Nothing
  Set lo_frmDPC_BOM = New frmDPC_BOM
  Load lo_frmDPC_BOM
  Set lo_frmDPC_BOM.Tools = mo_Tools
  Set lo_frmDPC_BOM.ArmDb = mo_Db
  Set lo_frmDPC_BOM.ArmDbBaeurer = mo_DbBaeurer
  lo_frmDPC_BOM.Language_Code = ms_Language_Code
  lo_frmDPC_BOM.Categ = ae_Categ
  lo_frmDPC_BOM.FilterEnabled = ab_EnableFilter
  Call lo_frmDPC_BOM.Load_A_COM

  Call mo_Tools.LockScreen(Me, False)
  Call mo_Tools.ShowModalForm(lo_frmDPC_BOM)
  Call mo_Tools.LockScreen(Me, True)
  If lo_frmDPC_BOM.Result Then
    Set lo_BOM = New DPC_BOM
    Call mo_PrdConfig.InitBOM(lo_BOM, eDPCRowStatus.rsNone)
    Call lo_BOM.LoadBOMFromBaeurer(mo_Db, mo_DbBaeurer, ms_Language_Code, lo_frmDPC_BOM.IdentNr)
    Set SelectRawMaterial = lo_BOM
  End If
  Call lo_frmDPC_BOM.Unload_A_COM
  Unload lo_frmDPC_BOM
  Set lo_frmDPC_BOM = Nothing
  Exit Function
ErrHandler:
  Call ErrorHandler("SelectRawMaterial")
End Function

Private Sub cbo_Packing_ComboItemSelected()
On Error GoTo ErrHandler
  
  If mb_InternalInit Then Exit Sub
  
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  Call mo_PrdConfig.LoadPacking(mo_Tools.GetComboKey(cbo_Packing))
  'Call LoadPackingPrice
  Call DisplayPacking
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_Packing_ComboItemSelected")
End Sub

Private Sub UpdateBORStagNr(ByVal al_AgId As Long, ByVal as_StAgNr As String)
On Error GoTo ErrHandler

Dim ls_IdentNr As String

  If mo_Tools.ReconnectSafe(mo_DbBaeurer, ms_BaeurerServer, ms_BaeurerDatabase, ms_BaeurerLoginName, ms_BaeurerPassword, ms_BaeurerSource) Then
    Call mo_CurrentBOR.Clear
    If (Trim(as_StAgNr) <> "") Or (al_AgId <> 0) Then
      If mo_CurrentBOR.LoadBORFromBaeurer(mo_DbBaeurer, al_AgId, as_StAgNr) Then
        If Not mo_CurrentBOR.LoadBORTimeFromBaeurer(mo_DbBaeurer, mo_PrdConfig) Then
          Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9852, "#Routing time couldn't be loaded from Baeurer")
        End If
      Else
        mo_CurrentBOR.BOR_StagNr = as_StAgNr
        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9853, "#Routing definition couldn't be loaded from Baeurer")
      End If
    End If
    Call DisplayBORFrame(mo_CurrentBOR)
  End If
  Exit Sub
ErrHandler:
  Call ErrorHandler("UpdateBORStagNr")
End Sub

Private Sub UpdateBOMIdentNr(ByVal as_IdentNr As String)
On Error GoTo ErrHandler

Dim lo_ErrCollection As New Collection
Dim ll_SideIdx As eDPCSide
  
  If mo_Tools.ReconnectSafe(mo_DbBaeurer, ms_BaeurerServer, ms_BaeurerDatabase, ms_BaeurerLoginName, ms_BaeurerPassword, ms_BaeurerSource) Then
    Call mo_CurrentBOM.Clear
    If Trim(as_IdentNr) <> "" Then
      If mo_CurrentBOM.LoadBOMFromBaeurer(mo_Db, mo_DbBaeurer, ms_Language_Code, as_IdentNr) Then
        mo_CurrentBOM.BOM_Categ = mo_CurrentBOM.GetMaterialCateg(mo_CurrentBOM.Agr)
        mo_CurrentBOM.BOM_CategDesc = mo_Tools.GetAReferenceData(eDPCReferenceML.rfBOMCategory, mo_CurrentBOM.BOM_Categ, ms_Language_Code)
        
        Select Case mo_CurrentBOM.BOM_Categ
        Case eDPCBOMMaterial.bcCoil, eDPCBOMMaterial.bcSheetMetal
          mo_PrdConfig.RPL_MatTyp = mo_CurrentBOM.BOM_Material
          If (mo_PrdConfig.RPL_CustDim And eDPCCoilLock.clCoilWidth) = 0 Then
            mo_PrdConfig.RPL_CoilW = mo_CurrentBOM.BOM_CutWidth
            mo_PrdConfig.RPL_Thick = mo_CurrentBOM.BOM_Thick
            mo_PrdConfig.COI_Code = mo_CurrentBOM.BOM_IdentNr
            mo_PrdConfig.COI_CodeTmp = mo_CurrentBOM.BOM_IdentNrTmp
            mo_PrdConfig.COI_SpcWgh = mo_CurrentBOM.BOM_SpecWeight
            If (mo_PrdConfig.RPL_CustDim And eDPCCoilLock.clBendingUZA) = 0 Then
              If mo_PrdConfig.RPL_CoilW > mo_PrdConfig.RPL_CoWMax Then
                Call mo_PrdConfig.CalcBendSizeU(mo_PrdConfig.RPL_CoWMax)
              Else
                Call mo_PrdConfig.CalcBendSizeU(mo_PrdConfig.RPL_CoilW)
              End If
              Call DisplayPanelMaterial
            End If
            Call mo_PrdConfig.CalculateWeight
            For ll_SideIdx = eDPCSide.esSideC To eDPCSide.esSideF
              Call DisplayBendingSide(ll_SideIdx)
            Next
            Call DisplayBending
          End If
          Call mo_CurrentBOM.CalculateCoil(mo_Db, mo_DbBaeurer, ms_Language_Code, mo_PrdConfig, lo_ErrCollection)
        Case eDPCBOMMaterial.bcGasket
          Call mo_CurrentBOM.CalculateGasket(mo_Db, mo_DbBaeurer, ms_Language_Code, "", mo_PrdConfig, lo_ErrCollection)
        Case eDPCBOMMaterial.bcSpacer
          Call mo_CurrentBOM.CalculateSpacer(mo_Db, mo_DbBaeurer, ms_Language_Code, "", mo_PrdConfig, lo_ErrCollection)
        Case eDPCBOMMaterial.bcCoating
          Call mo_CurrentBOM.CalculateCoating(mo_Db, mo_DbBaeurer, ms_Language_Code, mo_PrdConfig, lo_ErrCollection)
        Case eDPCBOMMaterial.bcInlay
          'Call mo_CurrentBOM.CalculateInlay(mo_Db, mo_DbBaeurer, ms_Language_Code, mo_PrdConfig, Nothing, lo_ErrCollection)
          Call mo_CurrentBOM.LoadBOMPriceFromBaeurer(mo_DbBaeurer, as_IdentNr, mo_CurrentBOM.BOM_Qty)
        Case Else
          Call mo_CurrentBOM.LoadBOMPriceFromBaeurer(mo_DbBaeurer, as_IdentNr, mo_CurrentBOM.BOM_Qty)
        End Select
      Else
        mo_CurrentBOM.BOM_IdentNr = as_IdentNr
        Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9854, "#Material definition couldn't be loaded from Baeurer")
      End If
    End If
    Call DisplayBOMFrame(mo_CurrentBOM)
  End If
  Exit Sub
ErrHandler:
  Call ErrorHandler("UpdateBOMIdentNr")
End Sub

Private Sub cmd_BOM_IdentNr_Click()
On Error GoTo ErrHandler

  Dim lb_Result As Boolean
  Dim lo_frmDPC_BOM As frmDPC_BOM
  
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  If mo_Tools.ReconnectSafe(mo_DbBaeurer, ms_BaeurerServer, ms_BaeurerDatabase, ms_BaeurerLoginName, ms_BaeurerPassword, ms_BaeurerSource) Then
    Set lo_frmDPC_BOM = New frmDPC_BOM
    Load lo_frmDPC_BOM
    Set lo_frmDPC_BOM.Tools = mo_Tools
    Set lo_frmDPC_BOM.ArmDb = mo_Db
    Set lo_frmDPC_BOM.ArmDbBaeurer = mo_DbBaeurer
    lo_frmDPC_BOM.Language_Code = ms_Language_Code
    mo_CurrentBOM.BOM_IdentNr = mo_Tools.GetTextValue(txt_Textbox, "BOM_IdentNr")
    Set lo_frmDPC_BOM.BOM = mo_CurrentBOM
    lo_frmDPC_BOM.Categ = mo_CurrentBOM.BOM_Categ
    lo_frmDPC_BOM.FilterEnabled = True
    Call lo_frmDPC_BOM.Load_A_COM
    
    Call mo_Tools.LockScreen(Me, False)
    Call mo_Tools.ShowModalForm(lo_frmDPC_BOM)
    Call mo_Tools.LockScreen(Me, True)
    lb_Result = lo_frmDPC_BOM.Result
    If lb_Result Then
      Call UpdateBOMIdentNr(lo_frmDPC_BOM.IdentNr)
    End If
    Call lo_frmDPC_BOM.Unload_A_COM
    Unload lo_frmDPC_BOM
    Set lo_frmDPC_BOM = Nothing
  End If
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  If lb_Result Then
    Call mo_Tools.SetTextFocus(txt_Textbox, "BOM_Qty")
  End If
  Exit Sub
ErrHandler:
  Call ErrorMessage("cmd_BOM_IdentNr_Click")
End Sub

Private Sub cmd_BOR_StagNr_Click()
On Error GoTo ErrHandler

  Dim lo_frmDPC_BOR As frmDPC_BOR
  Dim lb_Result As Boolean
  
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  If mo_Tools.ReconnectSafe(mo_DbBaeurer, ms_BaeurerServer, ms_BaeurerDatabase, ms_BaeurerLoginName, ms_BaeurerPassword, ms_BaeurerSource) Then
  
    Set lo_frmDPC_BOR = New frmDPC_BOR
    
    Load lo_frmDPC_BOR
    Set lo_frmDPC_BOR.Tools = mo_Tools
    Set lo_frmDPC_BOR.ArmDb = mo_Db
    Set lo_frmDPC_BOR.ArmDbBaeurer = mo_DbBaeurer
    lo_frmDPC_BOR.Language_Code = ms_Language_Code
    mo_CurrentBOR.BOR_StagNr = mo_Tools.GetTextValue(txt_Textbox, "BOR_StagNr")
    Set lo_frmDPC_BOR.BOR = mo_CurrentBOR
    Call lo_frmDPC_BOR.Load_A_COM
    
    Call mo_Tools.LockScreen(Me, False)
    Call mo_Tools.ShowModalForm(lo_frmDPC_BOR)
    Call mo_Tools.LockScreen(Me, True)
    lb_Result = lo_frmDPC_BOR.Result
    If lb_Result Then
      mo_CurrentBOR.BOR_AgId = lo_frmDPC_BOR.AgId
      mo_CurrentBOR.BOR_StagNr = ""
      Call UpdateBORStagNr(lo_frmDPC_BOR.AgId, "")
    End If
    Call lo_frmDPC_BOR.Unload_A_COM
    Unload lo_frmDPC_BOR
    Set lo_frmDPC_BOR = Nothing
  End If
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  If lb_Result Then
    Call mo_Tools.SetTextFocus(txt_Textbox, "BOR_Anz_Bedien")
  End If
  Exit Sub
ErrHandler:
  Call ErrorMessage("cmd_BOR_StagNr_Click")
End Sub

Private Sub cmd_Coating_Click()
On Error GoTo ErrHandler

  Dim lo_BOM As DPC_BOM

  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  If mo_Tools.ReconnectSafe(mo_DbBaeurer, ms_BaeurerServer, ms_BaeurerDatabase, ms_BaeurerLoginName, ms_BaeurerPassword, ms_BaeurerSource) Then
    Set lo_BOM = SelectRawMaterial(eDPCBOMMaterial.bcCoating, False)
    If Not lo_BOM Is Nothing Then
      Call mo_PrdConfig.LoadCoatingBOM(lo_BOM)
      If mo_PrdConfig.RPL_CoSid = eDPCCoatingExecution.ceUndef Then
        mo_PrdConfig.RPL_CoSid = eDPCCoatingExecution.ceOneSide
      End If
      Call DisplayCoating
    End If
  End If
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cmd_Coating_Click")
End Sub

Private Sub cmd_Copy_Click()
On Error GoTo ErrHandler

Dim lo_frmDPC_PrdCopy As frmDPC_PrdCopy
Dim lo_CopyProduct As DPC_Product
Dim lo_DPC_Generate As DPC_Generate
Dim lo_ErrCollection As Collection
Dim lo_Dictionary As New Dictionary
Dim lo_Inlay As DPC_Inlay
Dim lb_LengthHasChanged As Boolean
Dim lb_WidthHasChanged As Boolean

  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  
  Call mo_PrdConfig.CalculateCoWMinMax
  Call mo_PrdConfig.CalculateCutAB
  If Not CheckStep() Then
      mb_InternalInit = False
      Call mo_Tools.LockScreen(Me, False)
    Exit Sub
  End If

  Set lo_ErrCollection = New Collection
  
  Set lo_frmDPC_PrdCopy = New frmDPC_PrdCopy
  Load lo_frmDPC_PrdCopy
  Set lo_frmDPC_PrdCopy.Tools = mo_Tools
  Set lo_frmDPC_PrdCopy.ArmDb = mo_Db
  lo_frmDPC_PrdCopy.Language_Code = ms_Language_Code
  lo_frmDPC_PrdCopy.U_Code = ml_U_Code
  Call lo_frmDPC_PrdCopy.Load_A_COM
  
  Call mo_Tools.LockScreen(Me, False)
  Call mo_Tools.ShowModalForm(lo_frmDPC_PrdCopy)
  Call mo_Tools.LockScreen(Me, True)
  
  If lo_frmDPC_PrdCopy.Result Then
  
    If lo_frmDPC_PrdCopy.CopyBOM Or lo_frmDPC_PrdCopy.CopyBOR Then
      If Not mo_Tools.ReconnectSafe(mo_DbBaeurer, ms_BaeurerServer, ms_BaeurerDatabase, ms_BaeurerLoginName, ms_BaeurerPassword, ms_BaeurerSource) Then
        Call mo_Tools.LockScreen(Me, False)
        mb_InternalInit = False
        Exit Sub
      End If
    End If
    
    
    Set lo_CopyProduct = New DPC_Product
    Set lo_CopyProduct.Tools = mo_Tools
    Set lo_CopyProduct.ArmDb = mo_Db
    lo_CopyProduct.U_Code = ml_U_Code
    lo_CopyProduct.CT_Code = CT_Code
    lo_CopyProduct.CURR_Code = "EUR"
    lo_CopyProduct.ValidityDate = ValidityDate
    lo_CopyProduct.Language_Code = ms_Language_Code
    Call lo_CopyProduct.Load_A_COM
    Call lo_CopyProduct.Load(lo_frmDPC_PrdCopy.PRD_Id)
    If lo_frmDPC_PrdCopy.CopyAttributes Then
      lb_LengthHasChanged = mo_PrdConfig.RPL_PanA <> lo_CopyProduct.RPL_PanA
      lb_WidthHasChanged = mo_PrdConfig.RPL_PanB <> lo_CopyProduct.RPL_PanB
      Call lo_Dictionary.Add("PRD_Id", mo_PrdConfig.PRD_Id)
      Call lo_Dictionary.Add("PRD_Code", mo_PrdConfig.PRD_Code)
      Call lo_Dictionary.Add("PRD_Name", mo_PrdConfig.PRD_Name)
      Call lo_Dictionary.Add("PRD_Desc", mo_PrdConfig.PRD_Desc)
      Call lo_Dictionary.Add("RPL_StdGa", mo_PrdConfig.RPL_StdGa)
      Call lo_Dictionary.Add("RPL_GapC", mo_PrdConfig.RPL_Gap(eDPCSide.esSideC))
      Call lo_Dictionary.Add("RPL_GapD", mo_PrdConfig.RPL_Gap(eDPCSide.esSideD))
      Call lo_Dictionary.Add("RPL_GapE", mo_PrdConfig.RPL_Gap(eDPCSide.esSideE))
      Call lo_Dictionary.Add("RPL_GapF", mo_PrdConfig.RPL_Gap(eDPCSide.esSideF))
      Call lo_Dictionary.Add("RPL_ModA", mo_PrdConfig.RPL_ModA)
      Call lo_Dictionary.Add("RPL_ModB", mo_PrdConfig.RPL_ModB)
      
      Call lo_Dictionary.Add("RPL_StdMa", mo_PrdConfig.RPL_StdMa)
      Call lo_Dictionary.Add("MAT_Id", mo_PrdConfig.MAT_Id)
      Call lo_Dictionary.Add("MAT_Name", mo_PrdConfig.MAT_Name)
      Call lo_Dictionary.Add("MAT_Desc", mo_PrdConfig.MAT_Desc)
      'Call lo_Dictionary.Add("RPL_MatTyp", mo_PrdConfig.RPL_MatTyp)
      'Call lo_Dictionary.Add("MAT_BaeType", mo_PrdConfig.MAT_BaeType)
      Call lo_Dictionary.Add("MAT_Prefx", mo_PrdConfig.MAT_Prefx)
      Call lo_Dictionary.Add("COI_Code", mo_PrdConfig.COI_Code)
      Call lo_Dictionary.Add("COI_SpcWgh", mo_PrdConfig.COI_SpcWgh)
      Call lo_Dictionary.Add("COI_WasteFact", mo_PrdConfig.COI_WasteFact)
      Call lo_Dictionary.Add("COI_WasteQty", mo_PrdConfig.COI_WasteQty)
      Call lo_Dictionary.Add("COI_IsStock", mo_PrdConfig.COI_IsStock)
      
      Call lo_Dictionary.Add("RPL_Thick", mo_PrdConfig.RPL_Thick)
      Call lo_Dictionary.Add("RPL_UZC", mo_PrdConfig.RPL_U(eDPCSide.esSideC))
      Call lo_Dictionary.Add("RPL_UZD", mo_PrdConfig.RPL_U(eDPCSide.esSideD))
      Call lo_Dictionary.Add("RPL_CoilW", mo_PrdConfig.RPL_CoilW)
      Call lo_Dictionary.Add("RPL_CutA", mo_PrdConfig.RPL_CutA)
      Call lo_Dictionary.Add("RPL_CutB", mo_PrdConfig.RPL_CutB)
      Call lo_Dictionary.Add("RPL_DrwNr", mo_PrdConfig.RPL_DrwNr)
      Call lo_Dictionary.Add("RPL_CustDim", mo_PrdConfig.RPL_CustDim)
      Call lo_Dictionary.Add("STA_Id", mo_PrdConfig.STA_Id)
      
      Call mo_PrdConfig.CopyFrom(lo_CopyProduct)
    
      mo_PrdConfig.RPL_CustDim = lo_Dictionary.Item("RPL_CustDim")
      mo_PrdConfig.PRD_Id = lo_Dictionary.Item("PRD_Id")
      mo_PrdConfig.PRD_Code = lo_Dictionary.Item("PRD_Code")
      mo_PrdConfig.PRD_Name = lo_Dictionary.Item("PRD_Name")
      mo_PrdConfig.PRD_Desc = lo_Dictionary.Item("PRD_Desc")
      mo_PrdConfig.RPL_StdGa = lo_Dictionary.Item("RPL_StdGa")
      mo_PrdConfig.RPL_Gap(eDPCSide.esSideC) = lo_Dictionary.Item("RPL_GapC")
      mo_PrdConfig.RPL_Gap(eDPCSide.esSideD) = lo_Dictionary.Item("RPL_GapD")
      mo_PrdConfig.RPL_Gap(eDPCSide.esSideE) = lo_Dictionary.Item("RPL_GapE")
      mo_PrdConfig.RPL_Gap(eDPCSide.esSideF) = lo_Dictionary.Item("RPL_GapF")
      mo_PrdConfig.RPL_ModA = lo_Dictionary.Item("RPL_ModA")
      mo_PrdConfig.RPL_ModB = lo_Dictionary.Item("RPL_ModB")
      
      mo_PrdConfig.RPL_StdMa = lo_Dictionary.Item("RPL_StdMa")
      mo_PrdConfig.MAT_Id = lo_Dictionary.Item("MAT_Id")
      mo_PrdConfig.MAT_Name = lo_Dictionary.Item("MAT_Name")
      mo_PrdConfig.MAT_Desc = lo_Dictionary.Item("MAT_Desc")
      
      mo_PrdConfig.RPL_Thick = lo_Dictionary.Item("RPL_Thick")
      If (mo_PrdConfig.RPL_CustDim And eDPCCoilLock.clCoilWidth) <> 0 Then
        mo_PrdConfig.RPL_CoilW = lo_Dictionary.Item("RPL_CoilW")
        'mo_PrdConfig.RPL_MatTyp = lo_Dictionary.Item("RPL_MatTyp")
        'mo_PrdConfig.MAT_BaeType = lo_Dictionary.Item("MAT_BaeType")
        mo_PrdConfig.MAT_Prefx = lo_Dictionary.Item("MAT_Prefx")
        mo_PrdConfig.COI_Code = lo_Dictionary.Item("COI_Code")
        mo_PrdConfig.COI_SpcWgh = lo_Dictionary.Item("COI_SpcWgh")
        mo_PrdConfig.COI_WasteFact = lo_Dictionary.Item("COI_WasteFact")
        mo_PrdConfig.COI_WasteQty = lo_Dictionary.Item("COI_WasteQty")
        mo_PrdConfig.COI_IsStock = lo_Dictionary.Item("COI_IsStock")
      End If
      If (mo_PrdConfig.RPL_CustDim And eDPCCoilLock.clCutAB) <> 0 Then
        mo_PrdConfig.RPL_CutA = lo_Dictionary.Item("RPL_CutA")
        mo_PrdConfig.RPL_CutB = lo_Dictionary.Item("RPL_CutB")
      End If
      If (mo_PrdConfig.RPL_CustDim And eDPCCoilLock.clBendingUZA) <> 0 Then
        mo_PrdConfig.RPL_U(eDPCSide.esSideC) = lo_Dictionary.Item("RPL_UZC")
        mo_PrdConfig.RPL_U(eDPCSide.esSideD) = lo_Dictionary.Item("RPL_UZD")
      End If
      mo_PrdConfig.RPL_DrwNr = lo_Dictionary.Item("RPL_DrwNr")
      mo_PrdConfig.STA_Id = lo_Dictionary.Item("STA_Id")
      Call mo_PrdConfig.RecalcInlaySize
      If lb_LengthHasChanged Or lb_WidthHasChanged Then
        Call mo_PrdConfig.LoadThicknessHeight(lb_LengthHasChanged, False, lb_WidthHasChanged)
      End If
      Call mo_PrdConfig.CalculateCoWMinMax
      Call mo_PrdConfig.CalculateCutAB
      Call mo_PrdConfig.InitSetupCost
      'Call mo_PrdConfig.LoadPanelPrice
    End If
    If lo_frmDPC_PrdCopy.CopyBOM Then
      Call mo_PrdConfig.LoadBOM
      Call lo_CopyProduct.LoadBOM
      Call mo_PrdConfig.CopyBOMFrom(lo_CopyProduct)
      Call mo_PrdConfig.RecalcBOM(mo_DbBaeurer, lo_ErrCollection)
      
      Set lo_DPC_Generate = New DPC_Generate
      lo_DPC_Generate.CT_Code = CT_Code
      lo_DPC_Generate.CURR_Code = "EUR"
      lo_DPC_Generate.ValidityDate = ValidityDate
      lo_DPC_Generate.Language_Code = ms_Language_Code
      lo_DPC_Generate.U_Code = ml_U_Code
      Set lo_DPC_Generate.ArmDb = mo_Db
      Set lo_DPC_Generate.Tools = mo_Tools
      Call lo_DPC_Generate.Load_A_COM
      Call lo_DPC_Generate.AddBOMPacking(mo_DbBaeurer, mo_PrdConfig, lo_ErrCollection)
      Call lo_DPC_Generate.Unload_A_COM
      Set lo_DPC_Generate = Nothing
    End If
    If lo_frmDPC_PrdCopy.CopyBOR Then
      Call mo_PrdConfig.LoadBOR
      Call lo_CopyProduct.LoadBOR
      Call mo_PrdConfig.CopyBORFrom(lo_CopyProduct)
      Call mo_PrdConfig.RecalcBOR(mo_DbBaeurer, lo_ErrCollection)
    End If
    If lo_frmDPC_PrdCopy.CopyBOM Or lo_frmDPC_PrdCopy.CopyBOR Then
      Call mo_PrdConfig.CrossLinkBOMBOR
    End If
  End If
  Call ConfirmCheckList(lo_ErrCollection)
  Call lo_frmDPC_PrdCopy.Unload_A_COM
  Unload lo_frmDPC_PrdCopy
  Set lo_frmDPC_PrdCopy = Nothing
  Call mo_Tools.ClearCollection(lo_ErrCollection)
  Set lo_ErrCollection = Nothing
  
  Call DisplayData
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cmd_Copy_Click")
End Sub

Private Sub cmd_Inlay_Click(Index As Integer)
On Error GoTo ErrHandler

  Dim ls_IdentNr As String
  Dim lo_BOM As DPC_BOM
  Dim lo_Inlay As DPC_Inlay
  
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  If mo_Tools.ReconnectSafe(mo_DbBaeurer, ms_BaeurerServer, ms_BaeurerDatabase, ms_BaeurerLoginName, ms_BaeurerPassword, ms_BaeurerSource) Then
    Set lo_BOM = SelectRawMaterial(eDPCBOMMaterial.bcInlay, False)
    If Not lo_BOM Is Nothing Then
      Set lo_Inlay = mo_PrdConfig.GetInlayByIndex(Index)
      If lo_Inlay Is Nothing Then
        Set lo_Inlay = New DPC_Inlay
        Call mo_PrdConfig.InitInlay(lo_Inlay, eDPCRowStatus.rsAdd)
        Call mo_PrdConfig.InlayAdd(lo_Inlay)
      Else
        Call mo_PrdConfig.InlayUpdate(lo_Inlay)
      End If
      Call mo_PrdConfig.LoadInlayBOM(lo_BOM, lo_Inlay)
      Call lo_Inlay.CalcInlaySize(mo_PrdConfig)
      Call DisplayInlay
    End If
  End If
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cmd_Inlay_Click")
End Sub

Private Sub grd_BOM_ItemSelected()
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  If tlb_BOMMain.Enabled Then
    Call tlb_BOMMain_action("B", ms_Language_Code)
  End If
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("grd_BOM_ItemSelected")
End Sub

Private Sub grd_BOR_ItemSelected()
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  If tlb_BORMain.Enabled Then
    Call tlb_BORMain_action("B", ms_Language_Code)
  End If
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("grd_BOR_ItemSelected")
End Sub

'Private Sub grd_Packing_ItemSelected()
'On Error GoTo ErrHandler
'
'  If mb_InternalInit Then Exit Sub
'  mb_InternalInit = True
'  If tlb_PackMain.Enabled Then
'    Call tlb_PackMain_action("B", ms_Language_Code)
'  End If
'  mb_InternalInit = False
'  Exit Sub
'ErrHandler:
'  Call ErrorMessage("grd_Packing_ItemSelected")
'End Sub

Private Sub grd_File_ItemSelected()
On Error GoTo ErrHandler

Dim lo_frmDPC_File As frmDPC_File
Dim lo_File As DPC_File
  
  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  If grd_File.SelectedCount = 1 Then
    
    Set lo_File = mo_PrdConfig.GetFile(Val(grd_File.SelectedLine(0, "Idx")))
    If Not lo_File Is Nothing Then
    
      Set lo_frmDPC_File = New frmDPC_File
      Load lo_frmDPC_File
      lo_frmDPC_File.FIL_Id = lo_File.FIL_Id
      lo_frmDPC_File.Mode = eDPCScreenMode.smNone
      Set lo_frmDPC_File.Tools = mo_Tools
      Set lo_frmDPC_File.ArmDb = mo_Db
      lo_frmDPC_File.Language_Code = ms_Language_Code
      Call lo_frmDPC_File.Load_A_COM
    
      Call mo_Tools.LockScreen(Me, False)
      Call mo_Tools.ShowModalForm(lo_frmDPC_File)
      Call mo_Tools.LockScreen(Me, True)
    
      Call lo_frmDPC_File.Unload_A_COM
      Unload lo_frmDPC_File
    End If
  End If
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("grd_File_ItemSelected")
End Sub

Private Sub chk_ASFlag_Click()
On Error GoTo ErrHandler
  
  If mb_InternalInit Then Exit Sub
  If IsTemplate Then Exit Sub
  mb_InternalInit = True
  mo_PrdConfig.OFD_IsAsItem = (chk_ASFlag.Value = vbChecked)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("chk_ASFlag_Click")
End Sub

Private Sub chk_FreeOfCharge_Click()
On Error GoTo ErrHandler
  
  If mb_InternalInit Then Exit Sub
  If IsTemplate Then Exit Sub
  mb_InternalInit = True
  mo_PrdConfig.OFD_IsFree = (chk_FreeOfCharge.Value = vbChecked)
  'Call mo_PrdConfig.CalcPositionPrice
  'Call DisplayPrice(eDPCScreen.psNone)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("chk_FreeOfCharge_Click")
End Sub

Private Sub chk_Gasket_Click(Index As Integer)
On Error GoTo ErrHandler

Dim ls_Request As String
Dim ll_Idx As Long

  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  mo_PrdConfig.GTT_Selected(Index) = (chk_Gasket(Index).Value = vbChecked)
  Call cbo_GSK(Index).Clear
  
  If mo_PrdConfig.GTT_Selected(Index) Then
    Call mo_PrdConfig.LoadGasketDelivery(eDPCGasketDelivery.gdInstalled)
    
    Call InitGasketCombo(cbo_GSK(Index), eDPCGasketType.gtGasket, mo_PrdConfig.RPL_Gap(Index))
    Call cbo_GSK(Index).Load
    
    If cbo_GSK(Index).Count = 1 Then
      Call mo_PrdConfig.LoadGasket(eDPCGasketType.gtGasket, Index, cbo_GSK(Index).ComboItems(1).Key)
    Else
      For ll_Idx = eDPCSide.esSideC To eDPCSide.esSideF
        If (ll_Idx <> Index) And (mo_PrdConfig.GTT_Selected(ll_Idx)) Then
          If cbo_GSK(Index).SearchItem(mo_PrdConfig.GSK_Id(ll_Idx)) Then
            Call mo_PrdConfig.LoadGasket(eDPCGasketType.gtGasket, Index, cbo_GSK(Index).SelectedItem.Key)
            Exit For
          End If
        End If
      Next
    End If
  Else
    Call mo_PrdConfig.ResetGasket(eDPCGasketType.gtGasket, Index)
    If Not mo_PrdConfig.HasGasket Then
      Call mo_PrdConfig.LoadGasketDelivery(eDPCGasketDelivery.gdNoneGasket)
    End If
  End If
  
  Call mo_PrdConfig.UpdateGap(eDPCGasketType.gtGasket, Index)
  Call DisplayGasket
  Call DisplayPanelQtySize
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("chk_Gasket_Click")
End Sub

Private Sub chk_Gasket2_Click(Index As Integer)
On Error GoTo ErrHandler

Dim ls_Request As String
Dim ll_Idx As Long

  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  mo_PrdConfig.GTT_Selected2(Index) = (chk_Gasket2(Index).Value = vbChecked)
  Call cbo_GSK2(Index).Clear
  
  If mo_PrdConfig.GTT_Selected2(Index) Then
    Call mo_PrdConfig.LoadSpacerDelivery(eDPCSpacerDelivery.sdInstalled)
    
    Call InitGasketCombo(cbo_GSK2(Index), eDPCGasketType.gtSpacer, mo_Tools.SqlDbl(mo_PrdConfig.RPL_Gap(Index)))
    Call cbo_GSK2(Index).Load
    
    If cbo_GSK2(Index).Count = 1 Then
      Call mo_PrdConfig.LoadGasket(eDPCGasketType.gtSpacer, Index, cbo_GSK2(Index).ComboItems(1).Key)
    Else
      For ll_Idx = eDPCSide.esSideC To eDPCSide.esSideF
        If (ll_Idx <> Index) And (mo_PrdConfig.GTT_Selected2(ll_Idx)) Then
          If cbo_GSK2(Index).SearchItem(mo_PrdConfig.GSK_Id2(ll_Idx)) Then
            Call mo_PrdConfig.LoadGasket(eDPCGasketType.gtSpacer, Index, cbo_GSK2(Index).SelectedItem.Key)
            Exit For
          End If
        End If
      Next
    End If
  Else
    Call mo_PrdConfig.ResetGasket(eDPCGasketType.gtSpacer, Index)
    If Not mo_PrdConfig.HasSpacer Then
      Call mo_PrdConfig.LoadSpacerDelivery(eDPCSpacerDelivery.sdNoneSpacer)
    End If
  End If
  
  Call mo_PrdConfig.UpdateGap(eDPCGasketType.gtSpacer, Index)
  Call DisplaySpacer
  Call DisplayPanelQtySize
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("chk_Gasket2_Click")
End Sub

Private Sub cbo_Perforation_ComboItemSelected()
On Error GoTo ErrHandler
  
  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  Call mo_PrdConfig.LoadPerforation(mo_Tools.GetComboKey(cbo_Perforation))
  Call mo_PrdConfig.InitSetupCost
  'Call LoadPerforationPrice
  'Call LoadPanelPrice
  Call DisplayPerforation
  Call DisplayPerforationBorder
  Call DisplayBending
  Call DisplayPriceVisibility
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("cbo_Perforation_ComboItemSelected")
End Sub

Private Sub chk_InlaySetupCharge_Click(Index As Integer)
On Error GoTo ErrHandler

Dim lo_Offer As DPC_OfferPos
Dim lo_Inlay As DPC_Inlay

  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  Set lo_Inlay = mo_PrdConfig.GetInlayByIndex(Index)
  If Not lo_Inlay Is Nothing Then
    Set lo_Offer = lo_Inlay.GetOfferPos(eDPCOfferDetail.odInlaySetupCharge)
    If lo_Offer Is Nothing Then
      Err.Raise ArmErr.InvalidArgument, "chk_InlaySetupCharge(Index).Tag", "Unknown price checkbox: " & chk_InlaySetupCharge(Index).Tag
    Else
      lo_Offer.OFD_Valid = (chk_InlaySetupCharge(Index).Value = vbChecked)
      lo_Offer.ValidManual = IIf(lo_Offer.OFD_Valid, eDPCOfferPosValidManual.vmSetValid, eDPCOfferPosValidManual.vmSetInvalid)
      'Call mo_PrdConfig.CalcPositionPrice
    End If
  End If
  Call DisplayInlay
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("chk_InlaySetupCharge_Click")
End Sub

Private Sub chk_Price_Click(Index As Integer)
On Error GoTo ErrHandler

Dim lo_Offer As DPC_OfferPos
Dim lo_Offer2 As DPC_OfferPos
Dim ls_Tag As String

  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  ls_Tag = right(chk_Price(Index).Tag, Len(chk_Price(Index).Tag) - 4)
  Set lo_Offer = mo_PrdConfig.GetOfferPosByTag(ls_Tag)
  Set lo_Offer2 = Nothing
  
  If lo_Offer Is Nothing Then
    Err.Raise ArmErr.InvalidArgument, "chk_Price(Index).Tag", "Unknown price checkbox: " & chk_Price(Index).Tag
  Else
    If lo_Offer.DOF_Id = eDPCOfferDetail.odPanelSetupChargeUnp Then
      Set lo_Offer2 = mo_PrdConfig.GetOfferPos(eDPCOfferDetail.odPanelSetupChargePrf)
    ElseIf lo_Offer.DOF_Id = eDPCOfferDetail.odPanelSetupChargePrf Then
      Set lo_Offer2 = mo_PrdConfig.GetOfferPos(eDPCOfferDetail.odPanelSetupChargeUnp)
    ElseIf lo_Offer.DOF_Id = eDPCOfferDetail.odPanelChangeLengthCostUnp Then
      Set lo_Offer2 = mo_PrdConfig.GetOfferPos(eDPCOfferDetail.odPanelChangeLengthCostPrf)
    ElseIf lo_Offer.DOF_Id = eDPCOfferDetail.odPanelChangeLengthCostPrf Then
      Set lo_Offer2 = mo_PrdConfig.GetOfferPos(eDPCOfferDetail.odPanelChangeLengthCostUnp)
    ElseIf lo_Offer.DOF_Id = eDPCOfferDetail.odPanelChangeWidthCostUnp Then
      Set lo_Offer2 = mo_PrdConfig.GetOfferPos(eDPCOfferDetail.odPanelChangeWidthCostPrf)
    ElseIf lo_Offer.DOF_Id = eDPCOfferDetail.odPanelChangeWidthCostPrf Then
      Set lo_Offer2 = mo_PrdConfig.GetOfferPos(eDPCOfferDetail.odPanelChangeWidthCostUnp)
    End If
    
    lo_Offer.OFD_Valid = (chk_Price(Index).Value = vbChecked)
    lo_Offer.ValidManual = IIf(lo_Offer.OFD_Valid, eDPCOfferPosValidManual.vmSetValid, eDPCOfferPosValidManual.vmSetInvalid)
    If Not lo_Offer2 Is Nothing Then
      lo_Offer2.ValidManual = lo_Offer.ValidManual
    End If
    
    'Call mo_PrdConfig.CalcPositionPrice
    Call DisplayPriceVisibility
    'Call DisplayPrice
  End If
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("chk_Price_Click")
End Sub

Private Sub opt_CoatingSide_Click(Index As Integer)
On Error GoTo ErrHandler
  
  If mb_InternalInit Then Exit Sub
  
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  Call mo_PrdConfig.LoadCoatingSide(mo_Tools.WhichOptionIsTrue(opt_CoatingSide) + 1)
  
  Call DisplayCoating
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("opt_CoatingSide_Click")
End Sub

Private Sub opt_InOut_Click(Index As Integer)
On Error GoTo ErrHandler
  
  If mb_InternalInit Then Exit Sub
  
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  mo_PrdConfig.RPL_IsOut = IIf(Index = 0, eDPCPanelInOut.ioInside, eDPCPanelInOut.ioOutside)
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("opt_InOut_Click")
End Sub

Private Sub opt_UnperfBorder_Click(Index As Integer)
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  Call mo_PrdConfig.LoadPerforationBorder(mo_Tools.WhichOptionIsTrue(opt_UnperfBorder) + 1)
  Call DisplayPerforationBorder
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("opt_UnperfBorder_Click")
End Sub

Private Sub chk_PerfBorder_Click(Index As Integer)
On Error GoTo ErrHandler
  
  If mb_InternalInit Then Exit Sub
  
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  If chk_PerfBorder(Index).Value = vbUnchecked Then
    Call mo_PrdConfig.SetDefaultUnperforatedBorder(Index)
  Else
    Call mo_PrdConfig.SetDefaultOverperforatedBorder(Index)
  End If
  Call mo_PrdConfig.CalcPerfBorder
  Call DisplayPerforationBorder
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("chk_PerfBorder_Click")
End Sub

Private Sub chk_StandardPerf_Click()
On Error GoTo ErrHandler

Dim ll_SideIdx As Long
  
  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  mo_PrdConfig.PRF_IsStandard = (chk_StandardPerf.Value = vbChecked)
  If mo_PrdConfig.PRF_IsStandard Then
    For ll_SideIdx = eDPCSide.esSideC To eDPCSide.esSideF
      If chk_PerfBorder(ll_SideIdx).Value = vbChecked Then
        Call mo_PrdConfig.SetDefaultOverperforatedBorder(ll_SideIdx)
      Else
        Call mo_PrdConfig.SetDefaultUnperforatedBorder(ll_SideIdx)
      End If
    Next
  End If
  Call mo_PrdConfig.CalcPerfBorder
  Call DisplayPerforationBorder
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("chk_StandardPerf_Click")
End Sub

Private Sub chk_CorrectStep_Click()
On Error GoTo ErrHandler

  If mb_InternalInit Then Exit Sub
  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  mo_PrdConfig.PRF_IsCorrStep = (chk_CorrectStep.Value = vbChecked)
  Call mo_PrdConfig.CalcPerfBorder
  Call DisplayPerforationBorder
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("chk_CorrectStep_Click")
End Sub

Private Sub tlb_File_action(ByVal as_Role As String, as_Language As String)
On Error GoTo ErrHandler

Dim lo_frmDPC_File As frmDPC_File
Dim lo_File As DPC_File

  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  Select Case as_Role
  Case "A"
    Set lo_frmDPC_File = New frmDPC_File
    Load lo_frmDPC_File
    Set lo_File = New DPC_File
    Call mo_PrdConfig.InitFile(lo_File, eDPCRowStatus.rsAdd)
    lo_frmDPC_File.Mode = eDPCScreenMode.smAdd
    Set lo_frmDPC_File.Tools = mo_Tools
    Set lo_frmDPC_File.ArmDb = mo_Db
    lo_frmDPC_File.Language_Code = ms_Language_Code
    Call lo_frmDPC_File.Load_A_COM
  
    Call mo_Tools.LockScreen(Me, False)
    Call mo_Tools.ShowModalForm(lo_frmDPC_File)
    Call mo_Tools.LockScreen(Me, True)
  
    If lo_frmDPC_File.Result = True Then
      lo_File.FIL_Id = lo_frmDPC_File.FIL_Id
      lo_File.FIL_FileName = lo_frmDPC_File.txt_FileName.Text
      lo_File.FIL_Ext = lo_frmDPC_File.txt_FIL_Ext.Text
      lo_File.FIL_Name = lo_frmDPC_File.txt_FIL_Name.Text
      Call mo_PrdConfig.FileAdd(lo_File)
      Call DisplayFile
    End If
    
    Call lo_frmDPC_File.Unload_A_COM
    Unload lo_frmDPC_File
    
  Case "C"
    If grd_File.SelectedCount <> 1 Then
      Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9723, "#Please, select one row")
      Call mo_Tools.LockScreen(Me, False)
      mb_InternalInit = False
      Exit Sub
    End If
    If mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9735, "#Are you sure to remove this record ?", , VbMsgBoxStyle.vbYesNo) = vbYes Then
      Set lo_File = mo_PrdConfig.GetFile(Val(grd_File.SelectedLine(0, "Idx")))
      If Not lo_File Is Nothing Then
        Call mo_PrdConfig.FileDrop(lo_File)
        Call DisplayFile
      End If
    End If
  End Select
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("tlb_File_action")
End Sub

Private Sub txt_Textbox_Change(Index As Integer)
On Error GoTo ErrHandler
  
  If mb_InternalInit Then Exit Sub
  mb_CurrentTextBoxChanged = True
  Exit Sub
ErrHandler:
  Call ErrorMessage("txt_TextBox_Change")
End Sub

Private Sub txt_Textbox_KeyPress(Index As Integer, KeyAscii As Integer)
On Error GoTo ErrHandler
  
  If mb_InternalInit Then Exit Sub
  Select Case txt_Textbox(Index).Tag
  Case "BOM_IdentNr"
    If KeyAscii = 13 Then
      Call txt_Textbox_Validate(Index, False)
      Call cmd_BOM_IdentNr_Click
    ElseIf KeyAscii = 27 Then
      Call tlb_BOMDetail_action("T", ms_Language_Code)
    End If
  Case "BOM_Pos", "BOM_Name", "BOM_Qty", "BOM_Cost"
    If KeyAscii = 13 Then
      Call txt_Textbox_Validate(Index, False)
      Call tlb_BOMDetail_action("H", ms_Language_Code)
    ElseIf KeyAscii = 27 Then
      Call tlb_BOMDetail_action("T", ms_Language_Code)
    End If
  Case "BOR_StagNr"
    If KeyAscii = 13 Then
      Call txt_Textbox_Validate(Index, False)
      Call cmd_BOR_StagNr_Click
    ElseIf KeyAscii = 27 Then
      Call tlb_BORDetail_action("T", ms_Language_Code)
    End If
  Case "BOR_Pos", "BOR_Name", "BOR_Anz_Bedien", "BOR_Tr", "BOR_Brtr", "BOR_Lgtr", "BOR_Te", "BOR_VarPerFact"
    If KeyAscii = 13 Then
      Call txt_Textbox_Validate(Index, False)
      Call tlb_BORDetail_action("H", ms_Language_Code)
    ElseIf KeyAscii = 27 Then
      Call tlb_BORDetail_action("T", ms_Language_Code)
    End If
  Case "PPA_PalCode"
    If KeyAscii = 13 Then
      Call txt_Textbox_Validate(Index, False)
      Call cmd_PrdPacking_Click
    End If
  End Select
  Exit Sub
ErrHandler:
  Call ErrorMessage("txt_Textbox_KeyPress")
End Sub

Private Sub txt_Textbox_Validate(Index As Integer, Cancel As Boolean)
On Error GoTo ErrHandler

Dim ll_SideIdx As Long
Dim ll_ItemIdx As Long
Dim lo_Inlay As DPC_Inlay
Dim lo_Cutout As DPC_Cutout

  If mb_InternalInit Then Exit Sub
  If Not mb_CurrentTextBoxChanged Then Exit Sub
  
  Call mo_Tools.LockScreen(Me, True)
  ll_SideIdx = mo_PrdConfig.GetSideIndex(right(txt_Textbox(Index).Tag, 1))
  mb_InternalInit = True
  Select Case txt_Textbox(Index).Tag
  Case "PRD_Name"
    mo_PrdConfig.PRD_Name = Trim(txt_Textbox(Index).Text)
  Case "PRD_Code"
    mo_PrdConfig.PRD_Code = Trim(txt_Textbox(Index).Text)
  Case "OFD_PosCus"
    mo_PrdConfig.OFD_PosCus = Trim(txt_Textbox(Index).Text)
  Case "PanelQtyM2"
    mo_PrdConfig.PanelQtyM2 = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    If IsStandard And (Not mo_PrdConfig.IsQtyMatchingPU) Then
      If mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9733, "#Panel quantity does not represent correct packing unit. Do you want to update quantity automatically ?", , vbYesNo) Then
        mo_PrdConfig.PanelQtyM2 = mo_PrdConfig.GetCorrectPUQtyForM2
      End If
    End If
    Call DisplayPanelQtySize
  Case "PanelQtyPCS"
    mo_PrdConfig.PanelQtyPCS = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    If IsStandard And (Not mo_PrdConfig.IsQtyMatchingPU) Then
      If mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9733, "#Panel quantity does not represent correct packing unit. Do you want to update quantity automatically ?", , vbYesNo) Then
        mo_PrdConfig.PanelQtyPCS = mo_PrdConfig.GetCorrectPUQtyForPCS
      End If
    End If
    Call DisplayPanelQtySize
  Case "PRD_OfferComment"
    Call mo_PrdConfig.SetErrorText(eDPCError.erOfferComment, txt_Textbox(Index).Text, Nothing)
  Case "PRD_InternalComment"
    Call mo_PrdConfig.SetErrorText(eDPCError.erInternalComment, txt_Textbox(Index).Text, Nothing)
  Case "PanelQtyPU"
  Case "RPL_PU"
    mo_PrdConfig.RPL_PU = mo_Tools.ScreenToLong(txt_Textbox(Index).Text)
  Case "RPL_CorG1"
    'mo_PrdConfig.RPL_CorG1 = mo_Tools.ScreenToDbl(txt_TextBox(Index).Text)
  Case "RPL_CorG2"
    'mo_PrdConfig.RPL_CorG2 = mo_Tools.ScreenToDbl(txt_TextBox(Index).Text)
  Case "RPL_ModA"
    mo_PrdConfig.RPL_ModA = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    Call DisplayBending
    Call DisplayPanelQtySize
  Case "RPL_ModB"
    mo_PrdConfig.RPL_ModB = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    Call DisplayBending
    Call DisplayPanelQtySize
  Case "RPL_PanA"
    mo_PrdConfig.RPL_PanA = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    Call DisplayBending
  Case "RPL_PanB"
    mo_PrdConfig.RPL_PanB = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    Call DisplayBending
  Case "RPL_GapC", "RPL_GapD", "RPL_GapE", "RPL_GapF"
    mo_PrdConfig.RPL_Gap(ll_SideIdx) = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    Call mo_Tools.SetTextBox(txt_Textbox, "RPL_Gap" & mv_Edge(ll_SideIdx) & "_", mo_Tools.DblToScreen(mo_PrdConfig.RPL_Gap(ll_SideIdx)), False)
    Call DisplayBending
    Call DisplayPanelQtySize
  Case "RPL_CoilW"
    mo_PrdConfig.RPL_CoilW = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
  Case "RPL_Thick"
    mo_PrdConfig.RPL_Thick = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    For ll_ItemIdx = eDPCSide.esSideC To eDPCSide.esSideF
      Call DisplayBendingSide(ll_ItemIdx)
    Next
    Call DisplayBending
  Case "RPL_MatTyp"
    mo_PrdConfig.RPL_MatTyp = txt_Textbox(Index).Text
  Case "RPL_CoWMin"
    mo_PrdConfig.RPL_CoWMin = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
  Case "RPL_CoWMax"
    mo_PrdConfig.RPL_CoWMax = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
  Case "RPL_CutA"
    mo_PrdConfig.RPL_CutA = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    Call mo_PrdConfig.CalculateWeight
    Call DisplayBending
  Case "RPL_CutB"
    mo_PrdConfig.RPL_CutB = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    Call mo_PrdConfig.CalculateWeight
    Call DisplayBending
  Case "RPL_NWgh"
    mo_PrdConfig.RPL_NWgh = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
  Case "RPL_DrwNr"
    mo_PrdConfig.RPL_DrwNr = txt_Textbox(Index).Text
  Case "PCT_SizeDJ1", "PCT_SizeDJ2", "PCT_SizeDJ3", "PCT_SizeDJ4"
    ll_ItemIdx = Val(right(txt_Textbox(Index).Tag, 1)) - 1
    Set lo_Cutout = mo_PrdConfig.GetCutoutByIndex(ll_ItemIdx)
    If Not lo_Cutout Is Nothing Then
      If lo_Cutout.CUT_Shape = eDPCCutoutShape.eRectangular Then
        lo_Cutout.PCT_SizeJ = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
        lo_Cutout.PCT_SizeD = 0
      ElseIf lo_Cutout.CUT_Shape = eDPCCutoutShape.eRound Then
        lo_Cutout.PCT_SizeD = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
        lo_Cutout.PCT_SizeJ = 0
      End If
      Call mo_PrdConfig.CutoutUpdate(lo_Cutout)
    End If
    Call DisplayCutout
  Case "PCT_SizeK1", "PCT_SizeK2", "PCT_SizeK3", "PCT_SizeK4"
    ll_ItemIdx = Val(right(txt_Textbox(Index).Tag, 1)) - 1
    Set lo_Cutout = mo_PrdConfig.GetCutoutByIndex(ll_ItemIdx)
    If Not lo_Cutout Is Nothing Then
      If lo_Cutout.CUT_Shape = eDPCCutoutShape.eRectangular Then
        lo_Cutout.PCT_SizeK = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
      Else
        lo_Cutout.PCT_SizeK = 0
      End If
      Call mo_PrdConfig.CutoutUpdate(lo_Cutout)
    End If
    Call DisplayCutout
  Case "PCT_SizeL1", "PCT_SizeL2", "PCT_SizeL3", "PCT_SizeL4"
    ll_ItemIdx = Val(right(txt_Textbox(Index).Tag, 1)) - 1
    Set lo_Cutout = mo_PrdConfig.GetCutoutByIndex(ll_ItemIdx)
    If Not lo_Cutout Is Nothing Then
      lo_Cutout.PCT_SizeL = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
      Call mo_PrdConfig.CutoutUpdate(lo_Cutout)
    End If
    Call DisplayCutout
  Case "PCT_SizeM1", "PCT_SizeM2", "PCT_SizeM3", "PCT_SizeM4"
    ll_ItemIdx = Val(right(txt_Textbox(Index).Tag, 1)) - 1
    Set lo_Cutout = mo_PrdConfig.GetCutoutByIndex(ll_ItemIdx)
    If Not lo_Cutout Is Nothing Then
      lo_Cutout.PCT_SizeM = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
      Call mo_PrdConfig.CutoutUpdate(lo_Cutout)
    End If
    Call DisplayCutout
  Case "RPL_UBoWC", "RPL_UBoWD", "RPL_UBoWE", "RPL_UBoWF"
    mo_PrdConfig.RPL_UBoW(ll_SideIdx) = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    Call mo_PrdConfig.CalcPerfBorder
    Call DisplayPerforationBorder
  Case "RPL_UBorC", "RPL_UBorD", "RPL_UBorE", "RPL_UBorF"
  Case "PCT_UBoWC_V", "PCT_UBoWD_V", "PCT_UBoWE_V", "PCT_UBoWF_V"
  Case "PCT_UBoWC_L", "PCT_UBoWD_L", "PCT_UBoWE_L", "PCT_UBoWF_L"
  Case "PCT_UBoWC_C", "PCT_UBoWD_C", "PCT_UBoWE_C", "PCT_UBoWF_C"
  Case "PCT_UBorC_V", "PCT_UBorD_V", "PCT_UBorE_V", "PCT_UBorF_V"
  Case "PCT_UBorC_L", "PCT_UBorD_L", "PCT_UBorE_L", "PCT_UBorF_L"
  Case "PCT_UBorC_C", "PCT_UBorD_C", "PCT_UBorE_C", "PCT_UBorF_C"
  Case "INL_SizeA", "INL_SizeB", "INL_Desc"
  Case "INL_Code1", "INL_Code2", "INL_Code3"
    ll_ItemIdx = Val(right(txt_Textbox(Index).Tag, 1)) - 1
    Set lo_Inlay = mo_PrdConfig.GetInlayByIndex(ll_ItemIdx)
    If Trim(txt_Textbox(Index).Text) = "" Then
      If Not lo_Inlay Is Nothing Then
        Call mo_PrdConfig.InlayDrop(lo_Inlay)
      End If
    Else
      If lo_Inlay Is Nothing Then
        Set lo_Inlay = New DPC_Inlay
        Call mo_PrdConfig.InitInlay(lo_Inlay, eDPCRowStatus.rsAdd)
        Call mo_PrdConfig.InlayAdd(lo_Inlay)
      Else
        Call mo_PrdConfig.InlayUpdate(lo_Inlay)
      End If
      If Not lo_Inlay.LoadInlayCode(txt_Textbox(Index).Text) Then
        If mo_Tools.ReconnectSafe(mo_DbBaeurer, ms_BaeurerServer, ms_BaeurerDatabase, ms_BaeurerLoginName, ms_BaeurerPassword, ms_BaeurerSource) Then
          Call mo_PrdConfig.LoadInlayIdentNr(mo_DbBaeurer, txt_Textbox(Index).Text, lo_Inlay)
        End If
      End If
      Call lo_Inlay.CalcInlaySize(mo_PrdConfig)
    End If
    Call DisplayInlay
  Case "INL_Name1", "INL_Name2", "INL_Name3"
    ll_ItemIdx = Val(right(txt_Textbox(Index).Tag, 1)) - 1
    Set lo_Inlay = mo_PrdConfig.GetInlayByIndex(ll_ItemIdx)
    If Trim(txt_Textbox(Index).Text) = "" Then
      If Not lo_Inlay Is Nothing Then
        Call mo_PrdConfig.InlayDrop(lo_Inlay)
      End If
    Else
      If lo_Inlay Is Nothing Then
        Set lo_Inlay = New DPC_Inlay
        Call mo_PrdConfig.InitInlay(lo_Inlay, eDPCRowStatus.rsAdd)
        Call mo_PrdConfig.InlayAdd(lo_Inlay)
      Else
        Call mo_PrdConfig.InlayUpdate(lo_Inlay)
      End If
      Call mo_PrdConfig.SetErrorText(eDPCError.erInlayName, txt_Textbox(Index).Text, lo_Inlay)
      Call mo_PrdConfig.SetErrorText(eDPCError.erInlayDesc, "", lo_Inlay)
      lo_Inlay.INL_Name = txt_Textbox(Index).Text
      Call lo_Inlay.CalcInlaySize(mo_PrdConfig)
    End If
    Call DisplayInlay
  Case "COA_Code"
    If Trim(txt_Textbox(Index).Text) = "" Then
      Call mo_PrdConfig.ResetCoating
    Else
      mo_PrdConfig.COA_Code = txt_Textbox(Index).Text
    End If
    Call DisplayCoating
  Case "COA_Name"
    If Trim(txt_Textbox(Index).Text) = "" Then
      Call mo_PrdConfig.ResetCoating
    Else
      mo_PrdConfig.COA_Name = txt_Textbox(Index).Text
      Call mo_PrdConfig.SetErrorText(eDPCError.erCoatingName, mo_PrdConfig.COA_Name, Nothing)
    End If
    Call DisplayCoating
  Case "COA_Desc"
    mo_PrdConfig.COA_Desc = txt_Textbox(Index).Text
    Call mo_PrdConfig.SetErrorText(eDPCError.erCoatingDesc, mo_PrdConfig.COA_Desc, Nothing)
    Call DisplayCoating
  Case "RPL_PlCnt"
    mo_PrdConfig.RPL_PlCnt = mo_Tools.ScreenToLong(txt_Textbox(Index).Text)
    Call DisplayInlay
  Case "RPL_SwGap"
    mo_PrdConfig.RPL_SwGap = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
  Case "OFD_Pos"
    OFD_Pos = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
  Case "RPL_HC", "RPL_HD", "RPL_HE", "RPL_HF"
    mo_PrdConfig.RPL_H(ll_SideIdx) = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    If (ll_SideIdx = eDPCSide.esSideC) Or (ll_SideIdx = eDPCSide.esSideD) Then
      mo_PrdConfig.RPL_SBndA = False
    Else
      mo_PrdConfig.RPL_SBndB = False
    End If
    Call DisplayBendingSide(ll_SideIdx)
    Call DisplayBending
  Case "RPL_UC", "RPL_UD", "RPL_UE", "RPL_UF"
    mo_PrdConfig.RPL_U(ll_SideIdx) = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    If (ll_SideIdx = eDPCSide.esSideC) Or (ll_SideIdx = eDPCSide.esSideD) Then
      mo_PrdConfig.RPL_UMin(ll_SideIdx) = mo_PrdConfig.RPL_U(ll_SideIdx)
      mo_PrdConfig.RPL_UMax(ll_SideIdx) = mo_PrdConfig.RPL_U(ll_SideIdx)
    End If
    If (ll_SideIdx = eDPCSide.esSideC) Or (ll_SideIdx = eDPCSide.esSideD) Then
      mo_PrdConfig.RPL_SBndA = False
      mo_PrdConfig.RPL_SUZA = False
    Else
      mo_PrdConfig.RPL_SBndB = False
      mo_PrdConfig.RPL_SUZB = False
    End If
    Call DisplayBendingSide(ll_SideIdx)
    Call DisplayBending
  Case "RPL_UMinC", "RPL_UMinD"
    mo_PrdConfig.RPL_UMin(ll_SideIdx) = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    If (ll_SideIdx = eDPCSide.esSideC) Or (ll_SideIdx = eDPCSide.esSideD) Then
      mo_PrdConfig.RPL_SBndA = False
      mo_PrdConfig.RPL_SUZA = False
    Else
      mo_PrdConfig.RPL_SBndB = False
      mo_PrdConfig.RPL_SUZB = False
    End If
    Call DisplayBendingSide(ll_SideIdx)
    Call DisplayBending
  Case "RPL_UMaxC", "RPL_UMaxD"
    mo_PrdConfig.RPL_UMax(ll_SideIdx) = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    If (ll_SideIdx = eDPCSide.esSideC) Or (ll_SideIdx = eDPCSide.esSideD) Then
      mo_PrdConfig.RPL_SBndA = False
      mo_PrdConfig.RPL_SUZA = False
    Else
      mo_PrdConfig.RPL_SBndB = False
      mo_PrdConfig.RPL_SUZB = False
    End If
    Call DisplayBendingSide(ll_SideIdx)
    Call DisplayBending
  Case "RPL_SC", "RPL_SD", "RPL_SE", "RPL_SF"
    mo_PrdConfig.RPL_S(ll_SideIdx) = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    If (ll_SideIdx = eDPCSide.esSideC) Or (ll_SideIdx = eDPCSide.esSideD) Then
      mo_PrdConfig.RPL_SBndA = False
      mo_PrdConfig.RPL_SUZA = False
    Else
      mo_PrdConfig.RPL_SBndB = False
      mo_PrdConfig.RPL_SUZB = False
    End If
    Call DisplayBendingSide(ll_SideIdx)
    Call DisplayBending
  Case "RPL_SXC", "RPL_SXD", "RPL_SXE", "RPL_SXF"
    mo_PrdConfig.RPL_SX(ll_SideIdx) = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    If (ll_SideIdx = eDPCSide.esSideC) Or (ll_SideIdx = eDPCSide.esSideD) Then
      mo_PrdConfig.RPL_SBndA = False
      mo_PrdConfig.RPL_SUZA = False
    Else
      mo_PrdConfig.RPL_SBndB = False
      mo_PrdConfig.RPL_SUZB = False
    End If
    Call DisplayBendingSide(ll_SideIdx)
    Call DisplayBending
Case "MAT_CustTariff"
    mo_PrdConfig.MAT_CustTariff = txt_Textbox(Index).Text
  Case "RPL_CodePlan"
    mo_PrdConfig.RPL_CodePlan = mo_Tools.ScreenToLong(txt_Textbox(Index).Text)
  Case "RPL_MinStockLev"
    mo_PrdConfig.RPL_MinStockLev = mo_Tools.ScreenToLong(txt_Textbox(Index).Text)
  Case "RPL_MinPlanQty"
    mo_PrdConfig.RPL_MinPlanQty = mo_Tools.ScreenToLong(txt_Textbox(Index).Text)
  Case "PPA_PkgQty"
    mo_PrdConfig.PPA_PkgQty = mo_Tools.ScreenToLong(txt_Textbox(Index).Text)
    Call mo_PrdConfig.CalcPrdPacking
    Call DisplayPrdPacking
  Case "PPA_PkgA"
    mo_PrdConfig.PPA_PkgA = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    Call mo_PrdConfig.CalcPrdPacking
    Call DisplayPrdPacking
  Case "PPA_PkgB"
    mo_PrdConfig.PPA_PkgB = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    Call mo_PrdConfig.CalcPrdPacking
    Call DisplayPrdPacking
  Case "PPA_PkgH"
    mo_PrdConfig.PPA_PkgH = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    Call mo_PrdConfig.CalcPrdPacking
    Call DisplayPrdPacking
  Case "PPA_PalCode"
    Call UpdatePrdPackingIdentNr(txt_Textbox(Index).Text)
    Call mo_PrdConfig.CalcPrdPacking
    Call DisplayPrdPacking
  Case "PPA_PalA"
    mo_PrdConfig.PPA_PalA = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    Call mo_PrdConfig.CalcPrdPacking
    Call DisplayPrdPacking
  Case "PPA_PalB"
    mo_PrdConfig.PPA_PalB = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    Call mo_PrdConfig.CalcPrdPacking
    Call DisplayPrdPacking
  Case "PPA_PalH"
    mo_PrdConfig.PPA_PalH = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    Call mo_PrdConfig.CalcPrdPacking
    Call DisplayPrdPacking
  Case "PPA_PalQty"
    mo_PrdConfig.PPA_PalQty = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
    Call mo_PrdConfig.CalcPrdPacking
    Call DisplayPrdPacking
  Case "PPA_PkgPalQty"
    mo_PrdConfig.PPA_PkgPalQty = mo_Tools.ScreenToLong(txt_Textbox(Index).Text)
    Call mo_PrdConfig.CalcPrdPacking
    Call DisplayPrdPacking
  Case "PPA_LayQtyA"
    mo_PrdConfig.PPA_LayQtyA = mo_Tools.ScreenToLong(txt_Textbox(Index).Text)
    Call mo_PrdConfig.CalcPrdPacking
    Call DisplayPrdPacking
  Case "PPA_LayQtyB"
    mo_PrdConfig.PPA_LayQtyB = mo_Tools.ScreenToLong(txt_Textbox(Index).Text)
    Call mo_PrdConfig.CalcPrdPacking
    Call DisplayPrdPacking
  Case "PPA_LayQtyH"
    mo_PrdConfig.PPA_LayQtyH = mo_Tools.ScreenToLong(txt_Textbox(Index).Text)
    Call mo_PrdConfig.CalcPrdPacking
    Call DisplayPrdPacking
  Case "BOM_Pos"
    mo_CurrentBOM.BOM_Pos = mo_Tools.ScreenToLong(txt_Textbox(Index).Text)
  Case "BOM_IdentNr"
    Call UpdateBOMIdentNr(txt_Textbox(Index).Text)
  Case "BOM_Name"
    mo_CurrentBOM.BOM_Name = txt_Textbox(Index).Text
  Case "BOM_Qty"
    mo_CurrentBOM.BOM_Qty = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text, 3)
  Case "BOM_Cost"
    mo_CurrentBOM.BOM_Cost = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
  Case "BOR_Pos"
    mo_CurrentBOR.BOR_Pos = mo_Tools.ScreenToLong(txt_Textbox(Index).Text)
  Case "BOR_StagNr"
    Call UpdateBORStagNr(0, txt_Textbox(Index).Text)
  Case "BOR_Name"
    mo_CurrentBOR.BOR_Name = txt_Textbox(Index).Text
  Case "BOR_Anz_Bedien"
    mo_CurrentBOR.BOR_Anz_Bedien = mo_Tools.ScreenToLong(txt_Textbox(Index).Text)
  Case "BOR_Tr"
    mo_CurrentBOR.BOR_Tr = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
  Case "BOR_Brtr"
    mo_CurrentBOR.BOR_Brtr = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
  Case "BOR_Lgtr"
    mo_CurrentBOR.BOR_Lgtr = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
  Case "BOR_Te"
    mo_CurrentBOR.BOR_Te = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
  Case "BOR_VarPerFact"
    mo_CurrentBOR.BOR_VarPerFact = mo_Tools.ScreenToDbl(txt_Textbox(Index).Text)
  Case "BOR_WghPnt"
    mo_CurrentBOR.BOR_WghPnt = mo_Tools.ScreenToLong(txt_Textbox(Index).Text)
  Case "CLS_Name1", "CLS_Name2", "CLS_Name3", "CLS_Name4", "CLS_Name5", "CLS_Name6", "CLS_Name7", "CLS_Name8"
    ll_ItemIdx = Val(right(txt_Textbox(Index).Tag, 1)) - 1
    mo_PrdConfig.CLS_Name(ll_ItemIdx) = txt_Textbox(Index).Text
  Case "RPL_BaeType"
    mo_PrdConfig.RPL_BaeType = mo_Tools.ScreenToLong(txt_Textbox(Index).Text)
    Call DisplayPerforationBorder
  Case Else
    Call MsgBox("Unknown textbox tag:" & txt_Textbox(Index).Tag)
    'Err.Raise ArmErr.InvalidArgument, "txt_TextBox(" & Index & ").Tag", "Unknown textbox tag:" & txt_Textbox(Index).Tag
  End Select
  mb_InternalInit = False
  mb_CurrentTextBoxChanged = False
  Call mo_Tools.LockScreen(Me, False)
  Exit Sub
ErrHandler:
  Call ErrorMessage("txt_Textbox_Validate " & txt_Textbox(Index).Tag & ":" & txt_Textbox(Index).Text)
End Sub

Public Sub ItemNew(ByVal al_CAT_Id As eDPCCategory, ByVal al_SYS_Id As Long)
On Error GoTo ErrHandler

  mb_InternalInit = True
  me_PrdScreen = eDPCScreenMode.smAdd

  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorHandler("ItemNew")
End Sub

Public Sub ItemAdd(ByVal as_PRD_Id As String)
On Error GoTo ErrHandler

  mb_InternalInit = True
  me_PrdScreen = eDPCScreenMode.smAdd

  Call mo_PrdTemp.Load(as_PRD_Id)
  Call mo_PrdConfig.CopyFrom(mo_PrdTemp)
  mo_PrdConfig.PRD_IdPar = mo_PrdTemp.PRD_Id
  Set mo_PrdConfig.ProductTemplate = mo_PrdTemp
  
  Call mo_PrdConfig.Init
  mo_PrdConfig.PRD_Name = ""
  mo_PrdConfig.PRD_Desc = ""
  
  mo_PrdConfig.RPL_PerDe = eDPCPerimeterDelivery.pdNoPerimeter
  If mo_PrdTemp.HasPerforation Then
    mo_PrdConfig.RPL_PBord = eDPCPerforationBorderType.pbStandardUnperforated
  Else
    mo_PrdConfig.RPL_PBord = eDPCPerforationBorderType.pbUndef
  End If
  
  Call mo_PrdConfig.ResetCoating
  mo_PrdConfig.CAT_Id = eDPCCategory.cgMetalCustomRectPanel
  
  mo_PrdConfig.NoPerforation = True
  mo_PrdConfig.NoInlay = True
  mo_PrdConfig.NoCutout = True
  mo_PrdConfig.NoLoudspeaker = True
  mo_PrdConfig.NoVentilation = True
  Call mo_PrdConfig.ResetPriceFound
  
  If (mo_PrdConfig.LEV_Id = eDPCLevel.lvCustom) Or (mo_PrdConfig.LEV_Id = eDPCLevel.lvEngineered) Then
    Call cbo_Level.DeleteItemKey(eDPCLevel.lvStandard)
  End If
  
  'Call mo_PrdConfig.LoadVendorShipPoint(CT_Code)
  Call mo_PrdConfig.LoadSystemMargin
  Call mo_PrdConfig.LoadOfferOptions(COF_Id)
  Call DisplayData
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorHandler("ItemAdd")
End Sub

Public Sub ItemUpdate(ByVal as_PRD_Id As String)
On Error GoTo ErrHandler

Dim lo_Offer As DPC_OfferPos

  mb_InternalInit = True
  me_PrdScreen = eDPCScreenMode.smUpdate

  Call mo_PrdConfig.Load(as_PRD_Id)
  Call mo_PrdConfig.LoadPrdFile
  If (Not IsStandard) And (mo_PrdConfig.PRD_IdPar <> "") Then
    Call mo_PrdTemp.Load(mo_PrdConfig.PRD_IdPar)
    Set mo_PrdConfig.ProductTemplate = mo_PrdTemp
  End If

  mo_PrdConfig.NoPerforation = True
  mo_PrdConfig.NoInlay = True
  mo_PrdConfig.NoCutout = True
  mo_PrdConfig.NoLoudspeaker = True
  mo_PrdConfig.NoVentilation = True
  
  If (mo_PrdConfig.LEV_Id = eDPCLevel.lvCustom) Or (mo_PrdConfig.LEV_Id = eDPCLevel.lvEngineered) Then
    Call cbo_Level.DeleteItemKey(eDPCLevel.lvStandard)
  End If
  Call DisplayData
  If IsTemplate Then
    Call InitProductTemplate
  End If
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorHandler("ItemUpdate")
End Sub

Public Sub LoadOffer(ByVal as_COF_Id As String, ByVal as_OFD_IdPar As String)
On Error GoTo ErrHandler

Dim lo_ErrCol As Collection
  
  mb_InternalInit = True
  Call mo_PrdConfig.LoadOffer(as_COF_Id, as_OFD_IdPar)
  Call DisplayPanelQtySize
  Call DisplayPanelData
  Call DisplayPriceVisibility
  Call DisplayInlay
  'Call DisplayPrice
  ' do not check anything when production user editing template
'  If (Not IsTemplate) And (Not IsProduction) Then
'    Call ClearScreenErrorType(GetControl(fra_Step, GetStepFrameName(eDPCCategory.cgNone)))
'    Set lo_ErrCol = mo_PrdConfig.CheckScreen(eDPCCategory.cgNone)
'    Call ApplyScreenError(lo_ErrCol)
'  End If
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorHandler("LoadOffer")
End Sub

'Public Sub ApplyOffer(ByVal ao_OfferCollection As Collection)
'On Error GoTo ErrHandler
'
'Dim lo_ErrCol As Collection
'
'  mb_InternalInit = True
'  Call mo_PrdConfig.ApplyOffer(ao_OfferCollection)
'  Call DisplayPanelQtySize
''  Call DisplayPrice
''  ' do not check anything when production user editing template
''  If (Not IsTemplate) And (Not IsProduction) Then
''    Call ClearAllScreenErrorType
''    Set lo_ErrCol = mo_PrdConfig.CheckAllScreen
''    Call ApplyScreenError(lo_ErrCol)
''  End If
'  mb_InternalInit = False
'  Exit Sub
'ErrHandler:
'  Call ErrorHandler("ApplyOffer")
'End Sub

Public Sub ItemSave()
On Error GoTo ErrHandler

  If (me_PrdScreen = eDPCScreenMode.smAdd) Then
    Call mo_PrdConfig.Insert
  ElseIf me_PrdScreen = eDPCScreenMode.smUpdate Then
    Call mo_PrdConfig.Update
  End If
  Exit Sub
ErrHandler:
  Call ErrorHandler("ItemSave")
End Sub

Public Function GenerateOfferDetail() As Collection
On Error GoTo ErrHandler

Dim lo_Collection As Collection
Dim lo_Offer As DPC_OfferPos

  Set lo_Collection = mo_PrdConfig.GenerateOfferDetail
  For Each lo_Offer In lo_Collection
    lo_Offer.LEV_Id = mo_PrdConfig.LEV_Id
    If lo_Offer.DOF_Id = eDPCOfferDetail.odPosition Then
      lo_Offer.ERR_Type = eDPCErrorType.etNeedApproval
    Else
      lo_Offer.ERR_Type = eDPCErrorType.etNone
    End If
  Next
  Set GenerateOfferDetail = lo_Collection
  Exit Function
ErrHandler:
  Call ErrorHandler("GenerateOfferDetail")
End Function

Public Function GetMaxErrorType() As eDPCErrorType
On Error GoTo ErrHandler

Dim lo_Tab As MSComctlLib.Tab
Dim le_ErrType As eDPCErrorType
  
'  le_ErrType = eDPCErrorType.etNone
'  For Each lo_Tab In tbs_Step.Tabs
'    If lo_Tab.Image > le_ErrType Then
'      le_ErrType = lo_Tab.Image
'    End If
'  Next
'  GetMaxErrorType = le_ErrType
  Exit Function
ErrHandler:
  Call ErrorHandler("GetMaxErrorType")
End Function

Private Sub MarkGridRows(ByVal ao_grid As ArmGrid, ByVal as_TestCol As String, ByVal as_TestValue As String, ByVal as_MarkCol As String, ByVal al_Color As Long)
On Error GoTo ErrHandler

Dim ll_Idx As Long
  
  For ll_Idx = 0 To ao_grid.Rows - 1
    If StrComp(ao_grid.Data(ll_Idx, as_TestCol), as_TestValue, vbTextCompare) = 0 Then
      ao_grid.CellColor(ll_Idx, as_MarkCol) = al_Color
    End If
  Next
  Exit Sub
ErrHandler:
  Call ErrorHandler("MarkGridRows")
End Sub

Private Sub SetControlErrorColor(ByVal ao_Control As Object, ByVal ae_ERR_Type As eDPCErrorType)
On Error GoTo ErrHandler

Dim ll_Color As Long

  If Not ao_Control Is Nothing Then
    If ae_ERR_Type = eDPCErrorType.etStop Then
      ll_Color = RGB(255, 75, 75) 'vbRed
    ElseIf ae_ERR_Type = eDPCErrorType.etNeedApproval Then
      ll_Color = RGB(255, 225, 75) 'vbYellow
    ElseIf ae_ERR_Type = eDPCErrorType.etInfo Then
      ll_Color = RGB(0, 225, 255) 'vbBlue
    Else
      If TypeOf ao_Control Is VB.Frame Then
        ll_Color = vbWindowText
      Else
        ll_Color = vbButtonFace
      End If
    End If
    Select Case UCase(TypeName(ao_Control))
    Case UCase("Label"), UCase("CheckBox"), UCase("OptionButton")
      ao_Control.BackColor = ll_Color
    Case UCase("Frame")
      If ae_ERR_Type = eDPCErrorType.etNone Then
        ao_Control.Font.Bold = False
      Else
        ao_Control.Font.Bold = True
      End If
      ao_Control.ForeColor = ll_Color
    Case UCase("Tabstrip")
    End Select
  End If
  Exit Sub
ErrHandler:
  Call ErrorHandler("SetControlErrorColor")
End Sub

Private Sub ClearAllScreenErrorType()
On Error GoTo ErrHandler

Dim lo_Control As VB.Control
  
  For Each lo_Control In UserControl.Controls
    Call SetControlErrorColor(lo_Control, eDPCErrorType.etNone)
  Next
  Exit Sub
ErrHandler:
  Call ErrorHandler("ClearAllScreenErrorType")
End Sub

'Public Function FindControlByTag(ByRef ao_Controls As Object, ByRef ao_Frame As Frame, ByVal as_Tag As String) As VB.Control
'On Error GoTo errorHandler
'
'    Dim lo_Control As Object
'
'    Set FindControlByTag = Nothing
'
'    For Each lo_Control In ao_Controls
'      If (ao_Frame Is Nothing) Or mo_Tools.HasContainer(lo_Control, ao_Frame) Then
'        If StrComp(Trim(lo_Control.Tag), as_Tag, vbTextCompare) = 0 Then
'            Set FindControlByTag = lo_Control
'            Exit Function
'        End If
'      End If
'    Next
'    Exit Function
'errorHandler:
'    Call errorHandler("FindControlByTag")
'End Function

Private Sub ApplyScreenError(ByVal ao_ErrCol As Collection)
On Error GoTo ErrHandler

Dim lo_Error As DPC_Error
Dim lsa_ControlTags() As String
Dim lv_Tag As Variant
Dim lo_Control As VB.Control
Dim le_ERR_Type As eDPCErrorType

  For le_ERR_Type = eDPCErrorType.etInfo To eDPCErrorType.etStop
    For Each lo_Error In ao_ErrCol
      If le_ERR_Type = lo_Error.ERR_Type Then
        If Trim(lo_Error.ERR_Ctrl) <> "" Then
          lsa_ControlTags = Split(lo_Error.ERR_Ctrl, SEP)
          For Each lv_Tag In lsa_ControlTags
            Set lo_Control = mo_Tools.GetControl(UserControl.Controls, lv_Tag)
            If Not lo_Control Is Nothing Then
              Call SetControlErrorColor(lo_Control, le_ERR_Type)
            End If
          Next
        End If
      End If
    Next
  Next
  Exit Sub
ErrHandler:
  Call ErrorHandler("ApplyScreenError")
End Sub

Private Function CheckStep() As Boolean
On Error GoTo ErrHandler

Dim lo_ErrCol As Collection
Dim le_Screen As eDPCScreen
Dim ll_Idx As Long

  ' do not check anything when production user editing template
  If IsTemplate And IsProduction Then
    CheckStep = True
    Exit Function
  End If
  
  CheckStep = False
  
  Call ClearAllScreenErrorType
  Set lo_ErrCol = mo_PrdConfig.CheckAllScreen
  
  Call ApplyScreenError(lo_ErrCol)
  If ConfirmCheckList(lo_ErrCol) Then
    CheckStep = True
  End If
  Exit Function
ErrHandler:
  Call ErrorHandler("CheckStep")
End Function

Private Function ConfirmCheckList(ByVal ao_ErrCol As Collection) As Boolean
On Error GoTo ErrHandler

Dim lo_ErrorMsg As frmDPC_ErrorMsg
  
  ConfirmCheckList = True
  If ao_ErrCol.Count > 0 Then
    Set lo_ErrorMsg = New frmDPC_ErrorMsg
    Load lo_ErrorMsg
    Set lo_ErrorMsg.Tools = mo_Tools
    Set lo_ErrorMsg.ArmDb = mo_Db
    lo_ErrorMsg.Language_Code = ms_Language_Code
    lo_ErrorMsg.U_Code = ml_U_Code
    Set lo_ErrorMsg.ErrCollection = ao_ErrCol
    Call lo_ErrorMsg.Load_A_COM
    
    Call mo_Tools.LockScreen(Me, False)
    Call mo_Tools.ShowModalForm(lo_ErrorMsg)
    Call mo_Tools.LockScreen(Me, True)
    
    If lo_ErrorMsg.Result = False Then
      ConfirmCheckList = False
    End If
    Call mo_PrdConfig.UpdateErrorText(lo_ErrorMsg.ErrCollection)
    Call lo_ErrorMsg.Unload_A_COM
    Unload lo_ErrorMsg
  End If
  Exit Function
ErrHandler:
  Call ErrorHandler("ConfirmCheckList")
End Function

Private Sub EnableNavigation(ByVal ab_Enable As Boolean)
On Error GoTo ErrHandler

  btn_Validate.Enabled = ab_Enable
  btn_Quit.Enabled = ab_Enable
  btn_Error.Enabled = ab_Enable
'  tbs_Main.Enabled = ab_Enable
  Exit Sub
ErrHandler:
  Call ErrorHandler("EnableNavigation")
End Sub

Private Function CheckStepBOMItem(ByVal ao_BOM As DPC_BOM) As Boolean
On Error GoTo ErrHandler

Dim lbl_Field As VB.Label
Dim ls_FieldName As String

  CheckStepBOMItem = True
  If ao_BOM.BOM_Pos = 0 Then
    Set lbl_Field = mo_Tools.GetControl(lbl_Label, "lbl_BOMPosition")
    ls_FieldName = IIf(lbl_Field Is Nothing, "#Position", lbl_Field.Caption)
    Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9701, "#Please, enter mandatory field: $fieldname$", Array("$fieldname$", ls_FieldName))
    CheckStepBOMItem = False
    Exit Function
  End If
  If (Trim(ao_BOM.BOM_IdentNr) = "") Or (Trim(ao_BOM.BOM_Name) = "") Then
    Set lbl_Field = mo_Tools.GetControl(lbl_Label, "lbl_BOMArticle")
    ls_FieldName = IIf(lbl_Field Is Nothing, "#Article", lbl_Field.Caption)
    Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9701, "#Please, enter mandatory field: $fieldname$", Array("$fieldname$", ls_FieldName))
    CheckStepBOMItem = False
    Exit Function
  End If
  If ao_BOM.BOM_Qty = 0 Then
    Set lbl_Field = mo_Tools.GetControl(lbl_Label, "lbl_BOMQuantity")
    ls_FieldName = IIf(lbl_Field Is Nothing, "#Quantity", lbl_Field.Caption)
    Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9701, "#Please, enter mandatory field: $fieldname$", Array("$fieldname$", ls_FieldName))
    CheckStepBOMItem = False
    Exit Function
  End If
  If ao_BOM.BOM_Cost = 0 Then
    Set lbl_Field = mo_Tools.GetControl(lbl_Label, "lbl_BOMCost")
    ls_FieldName = IIf(lbl_Field Is Nothing, "#Cost", lbl_Field.Caption)
    Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9701, "#Please, enter mandatory field: $fieldname$", Array("$fieldname$", ls_FieldName))
    CheckStepBOMItem = False
    Exit Function
  End If
  Exit Function
ErrHandler:
  Call ErrorHandler("CheckStepBOMItem")
End Function

Private Function CheckStepBORItem(ByVal ao_BOR As DPC_BOR) As Boolean
On Error GoTo ErrHandler

Dim lbl_Field As VB.Label
Dim ls_FieldName As String
  
  CheckStepBORItem = True
  If ao_BOR.BOR_Pos = 0 Then
    Set lbl_Field = mo_Tools.GetControl(lbl_Label, "lbl_BORPosition")
    ls_FieldName = IIf(lbl_Field Is Nothing, "#Position", lbl_Field.Caption)
    Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9701, "#Please, enter mandatory field: $fieldname$", Array("$fieldname$", ls_FieldName))
    CheckStepBORItem = False
    Exit Function
  End If
  If (Trim(ao_BOR.BOR_StagNr) = "") Or (Trim(ao_BOR.BOR_Name) = "") Then
    Set lbl_Field = mo_Tools.GetControl(lbl_Label, "lbl_BORStdRouting")
    ls_FieldName = IIf(lbl_Field Is Nothing, "#Std. routing", lbl_Field.Caption)
    Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9701, "#Please, enter mandatory field: $fieldname$", Array("$fieldname$", ls_FieldName))
    CheckStepBORItem = False
    Exit Function
  End If
  If ao_BOR.BOR_Anz_Bedien = 0 Then
    Set lbl_Field = mo_Tools.GetControl(lbl_Label, "lbl_BOROperatorCount")
    ls_FieldName = IIf(lbl_Field Is Nothing, "#Op.cnt", lbl_Field.Caption)
    Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9701, "#Please, enter mandatory field: $fieldname$", Array("$fieldname$", ls_FieldName))
    CheckStepBORItem = False
    Exit Function
  End If
  If ao_BOR.BOR_Te = 0 Then
    Set lbl_Field = mo_Tools.GetControl(lbl_Label, "lbl_BOROperationTime")
    ls_FieldName = IIf(lbl_Field Is Nothing, "#Op. time", lbl_Field.Caption)
    Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9701, "#Please, enter mandatory field: $fieldname$", Array("$fieldname$", ls_FieldName))
    CheckStepBORItem = False
    Exit Function
  End If
  If ao_BOR.BOR_VarPerFact = 0 Then
    Set lbl_Field = mo_Tools.GetControl(lbl_Label, "lbl_BORSalaryFactor")
    ls_FieldName = IIf(lbl_Field Is Nothing, "#Sal.fact.", lbl_Field.Caption)
    Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9701, "#Please, enter mandatory field: $fieldname$", Array("$fieldname$", ls_FieldName))
    CheckStepBORItem = False
    Exit Function
  End If
  Exit Function
ErrHandler:
  Call ErrorHandler("CheckStepBORItem")
End Function

'Private Sub tlb_PackDetail_action(ByVal as_Role As String, as_Language As String)
'On Error GoTo ErrHandler
'
''Dim lo_BOM As DPC_BOM
'
'  'If mo_CurrentBOM Is Nothing Then Exit Sub
'
'  Call mo_Tools.LockScreen(Me, True)
'  Select Case as_Role
'  Case "H"
'    Select Case me_PackScreen
'    Case eDPCScreenMode.smAdd
''      If Not CheckStepBOMItem(mo_CurrentBOM) Then
''        Call mo_Tools.LockScreen(Me, False)
''        Exit Sub
''      End If
''      mo_CurrentBOM.BOM_Manual = True
''      mo_CurrentBOM.BOM_Status = eDPCBOMBORStatus.boGeneratedOK
''      mo_CurrentBOM.BOM_StatusDesc = mo_Tools.GetAReferenceData(eDPCReferenceML.rfBOMBORStatus, mo_CurrentBOM.BOM_Status, ms_Language_Code)
''      Call mo_PrdConfig.BOMAdd(mo_CurrentBOM)
'    Case eDPCScreenMode.smUpdate
''      If Not CheckStepBOMItem(mo_CurrentBOM) Then
''        Call mo_Tools.LockScreen(Me, False)
''        Exit Sub
''      End If
''      Set lo_BOM = mo_PrdConfig.GetBOM(mo_CurrentBOM.Idx)
''      If lo_BOM Is Nothing Then
''        Call mo_Tools.LockScreen(Me, False)
''        Exit Sub
''      Else
''        mo_CurrentBOM.BOM_Manual = True
''        mo_CurrentBOM.BOM_Status = eDPCBOMBORStatus.boGeneratedOK
''        mo_CurrentBOM.BOM_StatusDesc = mo_Tools.GetAReferenceData(eDPCReferenceML.rfBOMBORStatus, mo_CurrentBOM.BOM_Status, ms_Language_Code)
''        Call lo_BOM.CopyFrom(mo_CurrentBOM)
''        Call mo_PrdConfig.BOMUpdate(lo_BOM)
''      End If
'    Case eDPCScreenMode.smDelete
''      Call mo_PrdConfig.BOMDrop(mo_CurrentBOM)
'    Case Else
'      Err.Raise 0, "tlb_PackDetail_action", "Invalid screen mode"
'    End Select
''    Call UpdateBOMOrder
''    Call DisplayBOM
'    Call DisplayPackDetail(False)
'    Call EnableNavigation(True)
''    Set mo_CurrentBOM = Nothing
'  Case "I"
'    Select Case me_PackScreen
'    Case eDPCScreenMode.smAdd
''      Call mo_PrdConfig.InitBOM(mo_CurrentBOM, rsAdd)
''      Call DisplayBOMFrame(mo_CurrentBOM)
'    Case eDPCScreenMode.smUpdate
''      Set lo_BOM = mo_PrdConfig.GetBOM(mo_CurrentBOM.Idx)
''      If Not lo_BOM Is Nothing Then
''        Call mo_CurrentBOM.CopyFrom(lo_BOM)
''        Call DisplayBOMFrame(mo_CurrentBOM)
''      End If
'    End Select
'  Case "T"
'    Call DisplayPackDetail(False)
'    Call EnableNavigation(True)
'    Set mo_CurrentBOM = Nothing
'    me_PackScreen = eDPCScreenMode.smList
'  End Select
'  Call mo_Tools.LockScreen(Me, False)
''  If me_BOMScreen = eDPCScreenMode.smAdd Then
''    Call tlb_BOMMain_action("A", ms_Language_Code)
''  ElseIf me_BOMScreen = eDPCScreenMode.smList Then
''    mb_CurrentTextBoxChanged = False
''    Call mo_Tools.SetTextFocus(txt_Textbox, "OFD_Pos")
''  End If
'  Exit Sub
'ErrHandler:
'  Call ErrorMessage("tlb_PackDetail_action")
'End Sub
'
Private Sub tlb_BOMDetail_action(ByVal as_Role As String, as_Language As String)
On Error GoTo ErrHandler

Dim lo_BOM As DPC_BOM

  If mo_CurrentBOM Is Nothing Then Exit Sub
  
  Call mo_Tools.LockScreen(Me, True)
  Select Case as_Role
  Case "H"
    Select Case me_BOMScreen
    Case eDPCScreenMode.smAdd
      If Not CheckStepBOMItem(mo_CurrentBOM) Then
        Call mo_Tools.LockScreen(Me, False)
        Exit Sub
      End If
      mo_CurrentBOM.BOM_Manual = True
      mo_CurrentBOM.BOM_Status = eDPCBOMBORStatus.boGeneratedOK
      mo_CurrentBOM.BOM_StatusDesc = mo_Tools.GetAReferenceData(eDPCReferenceML.rfBOMBORStatus, mo_CurrentBOM.BOM_Status, ms_Language_Code)
      Call mo_PrdConfig.BOMAdd(mo_CurrentBOM)
    Case eDPCScreenMode.smUpdate
      If Not CheckStepBOMItem(mo_CurrentBOM) Then
        Call mo_Tools.LockScreen(Me, False)
        Exit Sub
      End If
      Set lo_BOM = mo_PrdConfig.GetBOM(mo_CurrentBOM.Idx)
      If lo_BOM Is Nothing Then
        Call mo_Tools.LockScreen(Me, False)
        Exit Sub
      Else
        mo_CurrentBOM.BOM_Manual = True
        mo_CurrentBOM.BOM_Status = eDPCBOMBORStatus.boGeneratedOK
        mo_CurrentBOM.BOM_StatusDesc = mo_Tools.GetAReferenceData(eDPCReferenceML.rfBOMBORStatus, mo_CurrentBOM.BOM_Status, ms_Language_Code)
        Call lo_BOM.CopyFrom(mo_CurrentBOM)
        Call mo_PrdConfig.BOMUpdate(lo_BOM)
      End If
    Case eDPCScreenMode.smDelete
      Call mo_PrdConfig.BOMDrop(mo_CurrentBOM)
    Case Else
      Err.Raise 0, "tlb_BOMDetail_action", "Invalid screen mode"
    End Select
    Call UpdateBOMOrder
    Call DisplayBOM
    Call DisplayBOMDetail(False)
    Call EnableNavigation(True)
    Set mo_CurrentBOM = Nothing
  Case "I"
    Select Case me_BOMScreen
    Case eDPCScreenMode.smAdd
      Call mo_PrdConfig.InitBOM(mo_CurrentBOM, rsAdd)
      Call DisplayBOMFrame(mo_CurrentBOM)
    Case eDPCScreenMode.smUpdate
      Set lo_BOM = mo_PrdConfig.GetBOM(mo_CurrentBOM.Idx)
      If Not lo_BOM Is Nothing Then
        Call mo_CurrentBOM.CopyFrom(lo_BOM)
        Call DisplayBOMFrame(mo_CurrentBOM)
      End If
    End Select
  Case "T"
    Call DisplayBOMDetail(False)
    Call EnableNavigation(True)
    Set mo_CurrentBOM = Nothing
    me_BOMScreen = eDPCScreenMode.smList
  End Select
  Call mo_Tools.LockScreen(Me, False)
  If me_BOMScreen = eDPCScreenMode.smAdd Then
    Call tlb_BOMMain_action("A", ms_Language_Code)
  ElseIf me_BOMScreen = eDPCScreenMode.smList Then
    mb_CurrentTextBoxChanged = False
    Call mo_Tools.SetTextFocus(txt_Textbox, "OFD_Pos")
  End If
  Exit Sub
ErrHandler:
  Call ErrorMessage("tlb_BOMDetail_action")
End Sub

Private Sub tlb_BORDetail_action(ByVal as_Role As String, as_Language As String)
On Error GoTo ErrHandler

Dim lo_BOR As DPC_BOR

  If mo_CurrentBOR Is Nothing Then Exit Sub
  
  Call mo_Tools.LockScreen(Me, True)
  Select Case as_Role
  Case "H"
    Select Case me_BORScreen
    Case eDPCScreenMode.smAdd
      If Not CheckStepBORItem(mo_CurrentBOR) Then
        Call mo_Tools.LockScreen(Me, False)
        Exit Sub
      End If
      mo_CurrentBOR.BOR_Manual = True
      mo_CurrentBOR.BOR_Status = eDPCBOMBORStatus.boGeneratedOK
      mo_CurrentBOR.BOR_StatusDesc = mo_Tools.GetAReferenceData(eDPCReferenceML.rfBOMBORStatus, mo_CurrentBOR.BOR_Status, ms_Language_Code)
      Call mo_PrdConfig.BORAdd(mo_CurrentBOR)
    Case eDPCScreenMode.smUpdate
      If Not CheckStepBORItem(mo_CurrentBOR) Then
        Call mo_Tools.LockScreen(Me, False)
        Exit Sub
      End If
      Set lo_BOR = mo_PrdConfig.GetBOR(mo_CurrentBOR.Idx)
      If lo_BOR Is Nothing Then
        Call mo_Tools.LockScreen(Me, False)
        Exit Sub
      Else
        mo_CurrentBOR.BOR_Manual = True
        mo_CurrentBOR.BOR_Status = eDPCBOMBORStatus.boGeneratedOK
        mo_CurrentBOR.BOR_StatusDesc = mo_Tools.GetAReferenceData(eDPCReferenceML.rfBOMBORStatus, mo_CurrentBOR.BOR_Status, ms_Language_Code)
        Call lo_BOR.CopyFrom(mo_CurrentBOR)
        Call mo_PrdConfig.BORUpdate(lo_BOR)
      End If
    Case eDPCScreenMode.smDelete
      Call mo_PrdConfig.BORDrop(mo_CurrentBOR)
    Case Else
      Err.Raise 0, "tlb_BORDetail_action", "Invalid screen mode"
    End Select
    Call UpdateBOROrder
    Call DisplayBOR
    Call DisplayBORDetail(False)
    Call EnableNavigation(True)
    Set mo_CurrentBOR = Nothing
  Case "I"
    Select Case me_BORScreen
    Case eDPCScreenMode.smAdd
      Call mo_PrdConfig.InitBOR(mo_CurrentBOR, rsAdd)
      Call DisplayBORFrame(mo_CurrentBOR)
    Case eDPCScreenMode.smUpdate
      Set lo_BOR = mo_PrdConfig.GetBOR(mo_CurrentBOR.Idx)
      If Not lo_BOR Is Nothing Then
        Call mo_CurrentBOR.CopyFrom(lo_BOR)
        Call DisplayBORFrame(mo_CurrentBOR)
      End If
    End Select
  Case "T"
    Call DisplayBORDetail(False)
    Call EnableNavigation(True)
    Set mo_CurrentBOR = Nothing
    me_BORScreen = eDPCScreenMode.smList
  End Select
  Call mo_Tools.LockScreen(Me, False)
  If me_BORScreen = eDPCScreenMode.smAdd Then
    Call tlb_BORMain_action("A", ms_Language_Code)
  ElseIf me_BORScreen = eDPCScreenMode.smList Then
    mb_CurrentTextBoxChanged = False
    Call mo_Tools.SetTextFocus(txt_Textbox, "OFD_Pos")
  End If
  Exit Sub
ErrHandler:
  Call ErrorMessage("tlb_BORDetail_action")
End Sub

'Private Sub tlb_PackMain_action(ByVal as_Role As String, as_Language As String)
'On Error GoTo ErrHandler
'
''Dim lo_BOM As DPC_BOM
'
'  Call mo_Tools.LockScreen(Me, True)
'  me_PackScreen = eDPCScreenMode.smList
'  Select Case as_Role
'  Case "A"
'    mb_InternalInit = True
'    me_PackScreen = eDPCScreenMode.smAdd
'    Call mo_Tools.ClearFrame(Controls, fra_PackDetail)
'    Call mo_Tools.EnableFrame(Controls, fra_PackDetail, True)
'    'Set mo_CurrentBOM = New DPC_BOM
'    'Call mo_PrdConfig.InitBOM(mo_CurrentBOM, eDPCRowStatus.rsAdd)
'    Call DisplayPackFrame(mo_CurrentBOM)
'    Call tlb_PackDetail.DisplayFace("1")
'    Call DisplayPackDetail(True)
'    Call EnableNavigation(False)
'    mb_InternalInit = False
'  Case "B"
'    If grd_Packing.SelectedCount <> 1 Then
'      Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9723, "#Please, select one row")
'      Call mo_Tools.LockScreen(Me, False)
'      Exit Sub
'    End If
'    mb_InternalInit = True
'    me_PackScreen = eDPCScreenMode.smUpdate
'    Call mo_Tools.ClearFrame(Controls, fra_PackDetail)
'    'Set lo_BOM = mo_PrdConfig.GetBOM(Val(grd_BOM.SelectedLine(0, "Idx")))
'    'If Not lo_BOM Is Nothing Then
'    '  Set mo_CurrentBOM = New DPC_BOM
'    '  Call mo_PrdConfig.InitBOM(mo_CurrentBOM, rsUpdate)
'    '  Call mo_CurrentBOM.CopyFrom(lo_BOM)
'      Call mo_Tools.EnableFrame(Controls, fra_PackDetail, True)
'      Call DisplayPackFrame(mo_CurrentBOM)
'      Call tlb_PackDetail.DisplayFace("2")
'      Call DisplayPackDetail(True)
'      Call EnableNavigation(False)
'    'End If
'    mb_InternalInit = False
'  Case "C"
'    If grd_Packing.SelectedCount <> 1 Then
'      Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9723, "#Please, select one row")
'      Call mo_Tools.LockScreen(Me, False)
'      Exit Sub
'    End If
'    mb_InternalInit = True
'    me_PackScreen = eDPCScreenMode.smDelete
'    'Set mo_CurrentBOM = mo_PrdConfig.GetBOM(Val(grd_BOM.SelectedLine(0, "Idx")))
'    'If Not mo_CurrentBOM Is Nothing Then
'      Call mo_Tools.ClearFrame(Controls, fra_PackDetail)
'      Call DisplayPackFrame(mo_CurrentBOM)
'      Call mo_Tools.EnableFrame(Controls, fra_PackDetail, False)
'      Call tlb_PackDetail.DisplayFace("3")
'      Call DisplayPackDetail(True)
'      Call EnableNavigation(False)
'    'End If
'    mb_InternalInit = False
'  End Select
'  Call mo_Tools.LockScreen(Me, False)
'  If me_PackScreen = eDPCScreenMode.smAdd Then
'    'Call mo_Tools.SetTextFocus(txt_Textbox, "BOM_Pos")
'  End If
'  Exit Sub
'ErrHandler:
'  Call ErrorMessage("tlb_PackMain_action")
'End Sub

Private Sub DisplayPrdPackDetail(ByVal ab_Visible As Boolean)
On Error GoTo ErrHandler
    
  If ab_Visible Then
    Call fra_PackDetail.Move(0, 0, fra_Detail(0).Width)
    'Call tlb_PackDetail.Move(fra_PackDetail.Width - tlb_PackDetail.Width, 100, tlb_PackDetail.Width, fra_PackDetail.Height)
    'Call grd_Packing.Move(0, fra_PackDetail.Top + fra_PackDetail.Height + 200, fra_Detail(0).Width, fra_Detail(0).Height - tlb_PackMain.Height - fra_PackDetail.Height - 200)
    Call fra_PackDetail.Zorder
  Else
    'Call grd_Packing.Move(0, tlb_PackMain.Height + 200, fra_Detail(0).Width, fra_Detail(0).Height - tlb_PackMain.Height - 200)
  End If
  fra_PackDetail.Visible = ab_Visible
  'tlb_PackDetail.Visible = ab_Visible
  'tlb_PackDetail.Enabled = ab_Visible
  'tlb_PackMain.Enabled = Not ab_Visible
  'grd_Packing.Enabled = Not ab_Visible
  tbs_Main.Enabled = Not ab_Visible
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayPrdPackDetail")
End Sub

Private Sub tlb_BOMMain_action(ByVal as_Role As String, as_Language As String)
On Error GoTo ErrHandler

Dim lo_BOM As DPC_BOM
Dim ll_CurrentRow As Long

  Call mo_Tools.LockScreen(Me, True)
  me_BOMScreen = eDPCScreenMode.smList
  Select Case as_Role
  Case "A"
    mb_InternalInit = True
    me_BOMScreen = eDPCScreenMode.smAdd
    Call mo_Tools.ClearFrame(Controls, fra_BOMDetail)
    Call mo_Tools.EnableFrame(Controls, fra_BOMDetail, True)
    Set mo_CurrentBOM = New DPC_BOM
    Call mo_PrdConfig.InitBOM(mo_CurrentBOM, eDPCRowStatus.rsAdd)
    Call DisplayBOMFrame(mo_CurrentBOM)
    Call tlb_BOMDetail.DisplayFace("1")
    Call DisplayBOMDetail(True)
    Call EnableNavigation(False)
    mb_InternalInit = False
  Case "B"
    If grd_BOM.SelectedCount <> 1 Then
      Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9723, "#Please, select one row")
      Call mo_Tools.LockScreen(Me, False)
      Exit Sub
    End If
    mb_InternalInit = True
    me_BOMScreen = eDPCScreenMode.smUpdate
    Call mo_Tools.ClearFrame(Controls, fra_BOMDetail)
    Set lo_BOM = mo_PrdConfig.GetBOM(Val(grd_BOM.SelectedLine(0, "Idx")))
    If Not lo_BOM Is Nothing Then
      Set mo_CurrentBOM = New DPC_BOM
      Call mo_PrdConfig.InitBOM(mo_CurrentBOM, rsUpdate)
      Call mo_CurrentBOM.CopyFrom(lo_BOM)
      Call mo_Tools.EnableFrame(Controls, fra_BOMDetail, True)
      Call DisplayBOMFrame(mo_CurrentBOM)
      Call tlb_BOMDetail.DisplayFace("2")
      Call DisplayBOMDetail(True)
      Call EnableNavigation(False)
    End If
    mb_InternalInit = False
  Case "C"
    If grd_BOM.SelectedCount <> 1 Then
      Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9723, "#Please, select one row")
      Call mo_Tools.LockScreen(Me, False)
      Exit Sub
    End If
    mb_InternalInit = True
    me_BOMScreen = eDPCScreenMode.smDelete
    Set mo_CurrentBOM = mo_PrdConfig.GetBOM(Val(grd_BOM.SelectedLine(0, "Idx")))
    If Not mo_CurrentBOM Is Nothing Then
      Call mo_Tools.ClearFrame(Controls, fra_BOMDetail)
      Call DisplayBOMFrame(mo_CurrentBOM)
      Call mo_Tools.EnableFrame(Controls, fra_BOMDetail, False)
      Call tlb_BOMDetail.DisplayFace("3")
      Call DisplayBOMDetail(True)
      Call EnableNavigation(False)
    End If
    mb_InternalInit = False
  Case "Y"
    If grd_BOM.SelectedCount <> 1 Then
      Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9723, "#Please, select one row")
      Call mo_Tools.LockScreen(Me, False)
      Exit Sub
    End If
    ll_CurrentRow = grd_BOM.Row
    If mo_PrdConfig.MoveBOMItem(Val(grd_BOM.SelectedLine(0, "Idx")), True) Then
      Call DisplayBOM
      grd_BOM.Row = ll_CurrentRow + 1
    End If
  Case "Z"
    If grd_BOM.SelectedCount <> 1 Then
      Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9723, "#Please, select one row")
      Call mo_Tools.LockScreen(Me, False)
      Exit Sub
    End If
    ll_CurrentRow = grd_BOM.Row
    If mo_PrdConfig.MoveBOMItem(Val(grd_BOM.SelectedLine(0, "Idx")), False) Then
      Call DisplayBOM
      grd_BOM.Row = ll_CurrentRow - 1
    End If
  End Select
  Call mo_Tools.LockScreen(Me, False)
  If me_BOMScreen = eDPCScreenMode.smAdd Then
    Call mo_Tools.SetTextFocus(txt_Textbox, "BOM_Pos")
  End If
  Exit Sub
ErrHandler:
  Call ErrorMessage("tlb_BOMMain_action")
End Sub

Private Sub DisplayBOMDetail(ByVal ab_Visible As Boolean)
On Error GoTo ErrHandler
    
  If ab_Visible Then
    Call fra_BOMDetail.Move(0, tlb_BOMMain.Height + 200, fra_Detail(0).Width)
    Call tlb_BOMDetail.Move(fra_BOMDetail.Width - tlb_BOMDetail.Width, 100, tlb_BOMDetail.Width, fra_BOMDetail.Height)
    Call grd_BOM.Move(0, fra_BOMDetail.Top + fra_BOMDetail.Height + 200, fra_Detail(0).Width, fra_Detail(0).Height - tlb_BOMMain.Height - fra_BOMDetail.Height - 200)
    Call fra_BOMDetail.Zorder
  Else
    Call grd_BOM.Move(0, tlb_BOMMain.Height + 200, fra_Detail(0).Width, fra_Detail(0).Height - tlb_BOMMain.Height - 200)
  End If
  fra_BOMDetail.Visible = ab_Visible
  tlb_BOMDetail.Visible = ab_Visible
  tlb_BOMDetail.Enabled = ab_Visible
  tlb_BOMMain.Enabled = Not ab_Visible
  grd_BOM.Enabled = Not ab_Visible
  tbs_Main.Enabled = Not ab_Visible
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayBOMDetail")
End Sub

Private Sub tlb_BORMain_action(ByVal as_Role As String, as_Language As String)
On Error GoTo ErrHandler

Dim lo_BOR As DPC_BOR
Dim ll_CurrentRow As Long

  Call mo_Tools.LockScreen(Me, True)
  me_BORScreen = eDPCScreenMode.smList
  Select Case as_Role
  Case "A"
    mb_InternalInit = True
    me_BORScreen = eDPCScreenMode.smAdd
    Call mo_Tools.ClearFrame(Controls, fra_BORDetail)
    Call mo_Tools.EnableFrame(Controls, fra_BORDetail, True)
    Set mo_CurrentBOR = New DPC_BOR
    Call mo_PrdConfig.InitBOR(mo_CurrentBOR, eDPCRowStatus.rsAdd)
    Call DisplayBORFrame(mo_CurrentBOR)
    Call tlb_BORDetail.DisplayFace("1")
    Call DisplayBORDetail(True)
    Call EnableNavigation(False)
    mb_InternalInit = False
  Case "B"
    If grd_BOR.SelectedCount <> 1 Then
      Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9723, "#Please, select one row")
      Call mo_Tools.LockScreen(Me, False)
      Exit Sub
    End If
    mb_InternalInit = True
    me_BORScreen = eDPCScreenMode.smUpdate
    Call mo_Tools.ClearFrame(Controls, fra_BORDetail)
    Set lo_BOR = mo_PrdConfig.GetBOR(Val(grd_BOR.SelectedLine(0, "Idx")))
    If Not lo_BOR Is Nothing Then
      Set mo_CurrentBOR = New DPC_BOR
      Call mo_PrdConfig.InitBOR(mo_CurrentBOR, rsUpdate)
      Call mo_CurrentBOR.CopyFrom(lo_BOR)
      Call mo_Tools.EnableFrame(Controls, fra_BORDetail, True)
      Call DisplayBORFrame(mo_CurrentBOR)
      Call tlb_BORDetail.DisplayFace("2")
      Call DisplayBORDetail(True)
      Call EnableNavigation(False)
    End If
    mb_InternalInit = False
  Case "C"
    If grd_BOR.SelectedCount <> 1 Then
      Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9723, "#Please, select one row")
      Call mo_Tools.LockScreen(Me, False)
      Exit Sub
    End If
    mb_InternalInit = True
    me_BORScreen = eDPCScreenMode.smDelete
    Set mo_CurrentBOR = mo_PrdConfig.GetBOR(Val(grd_BOR.SelectedLine(0, "Idx")))
    If Not mo_CurrentBOR Is Nothing Then
      Call mo_Tools.ClearFrame(Controls, fra_BORDetail)
      Call DisplayBORFrame(mo_CurrentBOR)
      Call mo_Tools.EnableFrame(Controls, fra_BORDetail, False)
      Call tlb_BORDetail.DisplayFace("3")
      Call DisplayBORDetail(True)
      Call EnableNavigation(False)
    End If
    mb_InternalInit = False
  Case "Y"
    If grd_BOR.SelectedCount <> 1 Then
      Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9723, "#Please, select one row")
      Call mo_Tools.LockScreen(Me, False)
      Exit Sub
    End If
    ll_CurrentRow = grd_BOR.Row
    If mo_PrdConfig.MoveBORItem(Val(grd_BOR.SelectedLine(0, "Idx")), True) Then
      Call DisplayBOR
      grd_BOR.Row = ll_CurrentRow + 1
    End If
  Case "Z"
    If grd_BOR.SelectedCount <> 1 Then
      Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9723, "#Please, select one row")
      Call mo_Tools.LockScreen(Me, False)
      Exit Sub
    End If
    ll_CurrentRow = grd_BOR.Row
    If mo_PrdConfig.MoveBORItem(Val(grd_BOR.SelectedLine(0, "Idx")), False) Then
      Call DisplayBOR
      grd_BOR.Row = ll_CurrentRow - 1
    End If
  End Select
  Call mo_Tools.LockScreen(Me, False)
  If me_BORScreen = eDPCScreenMode.smAdd Then
    Call mo_Tools.SetTextFocus(txt_Textbox, "BOR_Pos")
  End If
  Exit Sub
ErrHandler:
  Call ErrorMessage("tlb_BORMain_action")
End Sub

Private Sub DisplayBORDetail(ByVal ab_Visible As Boolean)
On Error GoTo ErrHandler
    
  If ab_Visible Then
    Call fra_BORDetail.Move(0, tlb_BORMain.Height + 200, fra_Detail(0).Width)
    Call tlb_BORDetail.Move(fra_BORDetail.Width - tlb_BORDetail.Width, 100, tlb_BORDetail.Width, fra_BORDetail.Height)
    Call grd_BOR.Move(0, fra_BORDetail.Top + fra_BORDetail.Height + 200, fra_Detail(0).Width, fra_Detail(0).Height - tlb_BORMain.Height - fra_BORDetail.Height - 200)
  Else
    Call grd_BOR.Move(0, tlb_BORMain.Height + 200, fra_Detail(0).Width, fra_Detail(0).Height - tlb_BORMain.Height - 200)
  End If
  fra_BORDetail.Visible = ab_Visible
  tlb_BORDetail.Visible = ab_Visible
  tlb_BORDetail.Enabled = ab_Visible
  tlb_BORMain.Enabled = Not ab_Visible
  grd_BOR.Enabled = Not ab_Visible
  tbs_Main.Enabled = Not ab_Visible
  Exit Sub
ErrHandler:
  Call ErrorHandler("DisplayBORDetail")
End Sub

Private Sub tbs_Main_Click()
On Error GoTo ErrHandler

Dim ll_Idx As Long
Dim ls_TabKey As String

  Call mo_Tools.LockScreen(Me, True)
  mb_InternalInit = True
  
  For ll_Idx = 0 To tbs_Main.Tabs.Count - 1
    fra_Detail(ll_Idx).Visible = (ll_Idx = tbs_Main.SelectedItem.Index - 1)
  Next
  ls_TabKey = tbs_Main.SelectedItem.Key
  
  If StrComp(ls_TabKey, "tbs_Attribute", vbTextCompare) = 0 Then
    If mo_PrdConfig.IsBOMChanged Or mo_PrdConfig.IsBORChanged Then
      Call mo_PrdConfig.InitCostCalc
      Call mo_PrdConfig.CalculateCost
    Else
      Call mo_PrdConfig.LoadCostCalc
    End If
    Call DisplayAttrib
  ElseIf (StrComp(ls_TabKey, "tbs_BOM", vbTextCompare) = 0) Or _
         (StrComp(ls_TabKey, "tbs_BOR", vbTextCompare) = 0) Then
    If Not mo_PrdConfig.IsBOMLoaded Then
      Call mo_PrdConfig.LoadBOM
    End If
    Call DisplayBOM
    If Not mo_PrdConfig.IsBORLoaded Then
      Call mo_PrdConfig.LoadBOR
    End If
    Call DisplayBOR
  ElseIf StrComp(ls_TabKey, "tbs_Packing", vbTextCompare) = 0 Then
    If Not mo_PrdConfig.IsPrdPackingLoaded Then
      Call mo_PrdConfig.LoadPrdPacking
    End If
    Call DisplayPrdPacking
    'Call DisplayPackSummary
  ElseIf StrComp(ls_TabKey, "tbs_PanelCost", vbTextCompare) = 0 Then
    If mo_PrdConfig.IsBOMChanged Or mo_PrdConfig.IsBORChanged Then
      Call mo_PrdConfig.InitCostCalc
      Call mo_PrdConfig.CalculateCost
    Else
      Call mo_PrdConfig.LoadCostCalc
    End If
    Call DisplayCostCalc
  End If
  mb_InternalInit = False
  Call mo_Tools.LockScreen(Me, False)
  Exit Sub
ErrHandler:
  Call ErrorMessage("tbs_Main_Click")
End Sub

Private Sub btn_Quit_Click()
On Error GoTo ErrHandler
  
  Call mo_Tools.LockScreen(Me, True)
  Result = False
  RaiseEvent quit
  Call mo_Tools.LockScreen(Me, False)
  Exit Sub
ErrHandler:
  Call ErrorMessage("btn_Quit_Click")
End Sub

Private Sub btn_Validate_Click()
On Error GoTo ErrHandler
  
  Call mo_Tools.LockScreen(Me, True)
  'Call mo_PrdConfig.ResetPriceFound
  If Not CheckStep() Then
    Call mo_Tools.LockScreen(Me, False)
    Exit Sub
  End If
  If mo_PrdConfig.IsBOMChanged Or mo_PrdConfig.IsBORChanged Then
    ' recalculate link between BOM and BOR (for B7)
    Call mo_PrdConfig.CrossLinkBOMBOR
    Call mo_PrdConfig.InitCostCalc
    Call mo_PrdConfig.CalculateCost
  End If
  Result = True
  RaiseEvent quit
  Call mo_Tools.LockScreen(Me, False)
  Exit Sub
ErrHandler:
  Call ErrorMessage("btn_Validate_Click")
End Sub

Private Sub btn_Error_Click()
On Error GoTo ErrHandler

Dim lo_ErrCol As Collection

  mb_InternalInit = True
  Call mo_Tools.LockScreen(Me, True)
  
  Call ClearAllScreenErrorType
  Set lo_ErrCol = mo_PrdConfig.CheckAllScreen
  Call ApplyScreenError(lo_ErrCol)
  Call UserControl.Refresh
  
  If lo_ErrCol.Count = 0 Then
    Call mo_Tools.ShowMsg(mo_Db, ms_Language_Code, 9732, "#No error or level 2 messsages")
  Else
    Call ConfirmCheckList(lo_ErrCol)
  End If
  Call mo_Tools.LockScreen(Me, False)
  mb_InternalInit = False
  Exit Sub
ErrHandler:
  Call ErrorMessage("btn_Error_Click")
End Sub

Public Sub SetFrameFocus()
On Error GoTo ErrHandler

'  Dim lo_Frame As VB.Frame
'
'  Set lo_Frame = GetControl(fra_Step, StepName)
'
'  Select Case UCase(lo_Frame.Tag)
'  Case UCase("fra_Panel")
'    If mo_PrdConfig.QtyType = eDPCQtyType.qtPCS Then
'      Call mo_Tools.SetTextFocus(txt_Textbox, "PanelQtyPCS")
'    Else
'      Call mo_Tools.SetTextFocus(txt_Textbox, "PanelQtyM2")
'    End If
'  Case UCase("fra_Gasket")
'  Case UCase("fra_Bending")
'  Case UCase("fra_Coating")
'  Case UCase("fra_Inlay")
'  Case UCase("fra_Perforation")
'  Case UCase("fra_Ventilation")
'  Case UCase("fra_Loudspeaker")
'  Case UCase("fra_Cutout")
'  Case UCase("fra_Summary")
'  End Select
  Exit Sub
ErrHandler:
  Call ErrorHandler("SetFrameFocus")
End Sub

Private Sub Resize()
On Error GoTo ErrHandler

Dim ll_Idx As Long
Dim lo_TextBox As TextBox

  btn_Validate.Top = UserControl.Height - btn_Validate.Height
  btn_Quit.Top = UserControl.Height - btn_Quit.Height
  btn_Error.Top = UserControl.Height - btn_Error.Height
  Call fra_Header.Move(60, 0, UserControl.Width - 120)
  Call tbs_Main.Move(fra_Header.Left, fra_Header.Top + fra_Header.Height, fra_Header.Width)
  For ll_Idx = 0 To tbs_Main.Tabs.Count - 1
    Call fra_Detail(ll_Idx).Move(tbs_Main.Left, tbs_Main.Top + tbs_Main.Height, tbs_Main.Width, btn_Validate.Top - tbs_Main.Top - tbs_Main.Height - 100)
  Next
  Set lo_TextBox = mo_Tools.GetControl(txt_Textbox, "PRD_InternalComment")
  Call lo_TextBox.Move(0, 0, fra_Detail(0).Width, fra_Detail(0).Height)
  Set lo_TextBox = mo_Tools.GetControl(txt_Textbox, "PRD_OfferComment")
  Call lo_TextBox.Move(0, 0, fra_Detail(0).Width, fra_Detail(0).Height)
  
  Call fra_Attrib.Move(0, 0, fra_Detail(0).Width)
  Call grd_Attrib.Move(0, fra_Attrib.Top + fra_Attrib.Height, fra_Detail(0).Width, fra_Detail(0).Height - (fra_Attrib.Top + fra_Attrib.Height))
  
  Call grd_CostCalc.Move(0, 0, fra_Detail(0).Width, fra_Detail(0).Height)
  
  'Call tlb_PackMain.Move(0, 200, fra_Detail(0).Width)
  'Call grd_Packing.Move(0, tlb_PackMain.Height + 200, fra_Detail(0).Width, fra_Detail(0).Height - tlb_PackMain.Height - 200)
  Call fra_PackDetail.Move(0, 0, fra_Detail(0).Width)
  
  Call tlb_BOMMain.Move(0, 200, fra_Detail(0).Width)
  Call grd_BOM.Move(0, tlb_BOMMain.Height + 200, fra_Detail(0).Width, fra_Detail(0).Height - tlb_BOMMain.Height - 200)
  
  Call tlb_BORMain.Move(0, 200, fra_Detail(0).Width)
  Call grd_BOR.Move(0, tlb_BORMain.Height + 200, fra_Detail(0).Width, fra_Detail(0).Height - tlb_BORMain.Height - 200)
  Exit Sub
ErrHandler:
  Call ErrorHandler("Resize")
End Sub

Private Function ReplaceCommonPlaceholders(ByVal as_Request As String) As String
On Error GoTo ErrHandler

  as_Request = Replace(as_Request, "$Z_Creator$", mo_Tools.SqlInt(ml_U_Code), , , vbTextCompare)
  as_Request = Replace(as_Request, "$U_Code$", mo_Tools.SqlInt(ml_U_Code), , , vbTextCompare)
  as_Request = Replace(as_Request, "$Z_Last_Upd_User$", mo_Tools.SqlInt(ml_U_Code), , , vbTextCompare)
  as_Request = Replace(as_Request, "$Language_Code$", mo_Tools.SqlStr(ms_Language_Code), , , vbTextCompare)
  as_Request = Replace(as_Request, "$COF_Lang$", mo_Tools.SqlStr(ms_COF_Lang), , , vbTextCompare)
  ReplaceCommonPlaceholders = as_Request
  Exit Function
ErrHandler:
  Call ErrorHandler("ReplaceCommonPlaceholders")
End Function

' display standard error message
Public Sub ErrorMessage(ByVal as_Fct As String)
    Dim ls_ErrSource As String
    Dim ls_errDescription As String
    Dim ls_Message As String
    
    ls_ErrSource = as_Fct & SEP1 & Err.Source
    ls_errDescription = Err.Description
    ls_Message = SCREEN_NAME & " exception. Nr:" & Err.Number & ",Desc: " & ls_errDescription & ",Src:" & ls_ErrSource & "@"
    Call mo_Tools.LogMessage(mo_Db, ml_U_Code, SCREEN_NAME, ls_Message, "E")
    Call MsgBox("Error occured, please contact IT. Application will now shutdown." & vbCrLf & ls_ErrSource & vbCrLf & "Description: " & ls_errDescription, vbCritical, App.Title & " " & App.Major & "." & App.Minor & "." & App.Revision)
    End
End Sub

' Standard error handler
Private Sub ErrorHandler(ByVal as_Fct As String)
  
    Call Err.Raise(Err.Number, Extender.Name & "." & as_Fct & SEP1 & Err.Source, Err.Description)
End Sub


