Untitled

 avatar
unknown
plain_text
a year ago
12 kB
5
Indexable
For RE = 1 To 2
        num = 0
        test_Pay_Type(0) = 0
        
        For TTP = 1 To 2
            test_TTP(0) = TTP
            For CC = 1 To NN_C
                test_CC(0) = CC
                X1 = Sheets("Setup").Cells(8, 7 + CC)
                X2 = Sheets("Setup").Cells(9, 7 + CC)
                NN = Sheets("Setup").Cells(6, 7 + CC)
                WW = Sheets("Setup").Cells(10, 7 + CC)
                    For MF = 1 To 2
                        If MF = 1 Then SEX$ = "M" Else SEX$ = "F"
                        test_MF(0) = MF
                        For X = X1 To X2
                            test_X(0) = X
                            If NN = 1 Then
                                test_Pay_Type(0) = 1
                                ptype = "single"
                            Else
                                test_Pay_Type(0) = test_Pay_Type(0) Mod 4 + 1
                                If test_Pay_Type(0) = 1 Then
                                    ptype = "year"
                                ElseIf test_Pay_Type(0) = 2 Then
                                    ptype = "halfyear"
                                ElseIf test_Pay_Type(0) = 3 Then
                                    ptype = "season"
                                ElseIf test_Pay_Type(0) = 4 Then
                                    ptype = "month"
                                End If
                            End If
                            For Dis1 = 1 To 7
                            
                                    If Sheets("Setup").Cells(12, 4) = 1 Then RR_end = 2 Else RR_end = 1
                                    For RR = 1 To RR_end
                                        If (NN = 1 And RR = 2) Or NN <> 1 Then
                                            num = num + 1
                                            If RE = 1 Then num1 = num1 + 1
                                            If RE = 2 Then
                                                '增值回饋分享金選擇方式
                                                test_RD(1) = RR
                                                test_RD(2) = test_RD(2) Mod 4 + 1
                                                
                                                'If NN <= Sheets("試算表").Cells(17, 2) And test_RD(2) = 1 Then test_RD(2) = test_RD(2) + 1
                                                
                                                
                                                If test_RD(1) = 1 Then RD_1 = "PMST" Else RD_1 = "PUAD"         '第1~5年回饋金選擇
                                                If test_RD(2) = 1 Then                                          '第6年後回饋金選擇
                                                    RD_2 = "PMST"
                                                ElseIf test_RD(2) = 2 Then
                                                    RD_2 = "PUAD"
                                                ElseIf test_RD(2) = 3 Then
                                                    RD_2 = "DVAC"
                                                ElseIf test_RD(2) = 4 Then
                                                    RD_2 = "CSWD"
                                                End If
                                                
                                                '宣告利率
'                                                If HKLL_num >= 1 And num <= (num1 / 2) * 1 / HKLL_num Then
'                                                    RI = 1
'                                                ElseIf HKLL_num >= 2 And num <= (num1 / 2) * 1 / HKLL_num + ((num1 / 2) * 2 / HKLL_num - (num1 / 2) * 1 / HKLL_num) * (1 / 10) Then
'                                                    RI = 2
'                                                ElseIf HKLL_num >= 3 And num <= (num1 / 2) * 3 / HKLL_num Then
'                                                    RI = 3
'                                                ElseIf HKLL_num >= 4 And num <= (num1 / 2) * 4 / HKLL_num + ((num1 / 2) * 5 / HKLL_num - (num1 / 2) * 4 / HKLL_num) * (9 / 10) Then
'                                                    RI = 4
'                                                ElseIf HKLL_num >= 5 And num <= (num1 / 2) * 5 / HKLL_num Then
'                                                    RI = 5
'                                                ElseIf HKLL_num >= 1 And num <= (num1 / 2) * (HKLL_num + 1) / HKLL_num Then
'                                                    RI = 1
'                                                ElseIf HKLL_num >= 2 And num <= (num1 / 2) * (HKLL_num + 1) / HKLL_num + ((num1 / 2) * (HKLL_num + 2) / HKLL_num - (num1 / 2) * (HKLL_num + 1) / HKLL_num) * (1 / 10) Then
'                                                    RI = 2
'                                                ElseIf HKLL_num >= 3 And num <= (num1 / 2) * (HKLL_num + 3) / HKLL_num Then
'                                                    RI = 3
'                                                ElseIf HKLL_num >= 4 And num <= (num1 / 2) * (HKLL_num + 4) / HKLL_num + ((num1 / 2) * (HKLL_num + 5) / HKLL_num - (num1 / 2) * (HKLL_num + 4) / HKLL_num) * (9 / 10) Then
'                                                    RI = 4
'                                                Else
'                                                    RI = 5
'                                                End If
                                                
                                                '保額
                                                If TTP = 1 Then
                                                    If num = 1 Or test_SA(0) = max_SA / 10000 Or (X <= 15 And test_SA(0) = max_SA_15 / 10000) Then
                                                        test_SA(0) = min_SA / 10000 + temp * 1111 / 10000
                                                        temp = temp + 1
                                                    Else
                                                        If X > 15 Then
                                                            test_SA(0) = Round(WorksheetFunction.min(test_SA(0) + 0.8 + unit / 10000, max_SA / 10000), 4)
                                                        Else
                                                            test_SA(0) = Round(WorksheetFunction.min(test_SA(0) + 0.8 + unit / 10000, max_SA_kid / 10000), 4)
                                                        End If
                                                    End If
                                                Else
                                                    Erase test_SA
                                                    If num = (num1 - 1) / 2 + 1 Or SA_O >= max_SA / 10000 Or (X <= 15 And SA_O >= max_SA_kid / 10000) Then
                                                        SA_O = min_SA / 10000
                                                    ElseIf X <= 15 Then
                                                        SA_O = Round(min(SA_O + 1.1 + unit / 10000, max_SA_kid / 10000), 4)
                                                    Else
                                                        SA_O = Round(min(SA_O + 10.1 + unit / 10000, max_SA / 10000), 4)
                                                    End If
                                                End If
                                                '保費
                                                If TTP = 2 Then
                                                    If num = (num1 - 1) / 2 + 1 Then test_GP1(0) = Round(G(MF, CC, X) * SA_O, 0) Else test_GP1(0) = Round(G(MF, CC, X) * SA_O, 0)
                                                Else
                                                    Erase test_GP1
                                                End If
                                                If CAREER + 1 > 6 Then CAREER = 1 Else CAREER = CAREER + 1
                                                
                                                test_HKLL(0) = Sheets("Setup").Cells(80, 3 + RI)
                                                Sheets("腳本").Cells(num + 1, 1) = num
                                                Sheets("腳本").Cells(num + 1, 2) = CURR                                        '幣別
                                                Sheets("腳本").Cells(num + 1, 3) = ptype                                       '繳別
                                                Sheets("腳本").Cells(num + 1, 4) = Dis1                                        '折扣組
                                                Sheets("腳本").Cells(num + 1, 5) = "True"                                      '主約
                                                Sheets("腳本").Cells(num + 1, 6) = Plancode1                                   'Plancode
                                                Sheets("腳本").Cells(num + 1, 7) = Plancode2                                   '英文簡稱
                                                Sheets("腳本").Cells(num + 1, 8) = "O"                                         '投保對象
                                                Sheets("腳本").Cells(num + 1, 9) = "test"                                      '姓名
                                                Sheets("腳本").Cells(num + 1, 10) = SEX$                                       '性別
                                                Sheets("腳本").Cells(num + 1, 11) = X                                          '保險年齡
                                                Sheets("腳本").Cells(num + 1, 12) = X                                          '足歲年齡
                                                Sheets("腳本").Cells(num + 1, 13) = "N"                                        '判斷職業代碼
                                                Sheets("腳本").Cells(num + 1, 14) = CAREER                                     '職業等級
                                                Sheets("腳本").Cells(num + 1, 15) = NN                                         '繳費年期
                                                Sheets("腳本").Cells(num + 1, 16) = Sheets("Setup").Cells(10, 7 + CC) & "@"    '保障年期
                                                
                                                If TTP = 1 Then
                                                    Sheets("腳本").Cells(num + 1, 21) = test_SA(0) * 10000           '保額
                                                Else
                                                    Sheets("腳本").Cells(num + 1, 22) = test_GP1(0)                  '保費
                                                End If
                                                If Sheets("Setup").Cells(9, 3) = 1 Then
                                                    Sheets("腳本").Cells(num + 1, 23) = test_HKLL(0) * 100           '宣告利率
                                                    Sheets("腳本").Cells(num + 1, 24) = RD_1                         '回饋金選擇方式1
                                                    Sheets("腳本").Cells(num + 1, 25) = RD_2                         '回饋金選擇方式2
                                                End If

                                        End If
                                    Next RR
                            Next Dis1
                        Next X
                    Next MF
                End If
            Next CC
        Next TTP
    Next RE
    
Editor is loading...
Leave a Comment