 prm BuildScreen17 msg;sn;fd;wid;form;gap;qt;labs;xx;isAdhoc;xxx;data;
 Build Policy screen (17)
 NB. Data attributes are used to store control/label maps

 xxx sn qtprm                           resize flag, screen number, quotation type
 CurrScreensn                          global tracking which screen is "current"
 isAdhocqt=#.CONSTANTS.QUOTETYPES.ADHOC
 xxxSVQ_SWITCH_FIELDS
 formsnforms

 gap fd7 22
 widfd{'Size'(,)}

 EXWN form

 form MakeLabels 8
 :With form

     Contract Source Assurer Status
     'E1' 'C1' 'Ass' 'C2'WC'Label'('Justify' 'Center'),wid80 50 50 50

     Platform, Product Type, Product
     :If isAdhoc
         {'Combo'('Items')}(#.Policy.CONSTANTS.PRODUCTS.Platform)('')('')
     :Else
         ('Label')('Justify' 'Center')
     :EndIf
     'Pltfm' 'C3' 'C4'WC,wid60 60 280

     StartDate
     'E2'WC('Label'BUT'Edit'IF isAdhoc)(wid 70)('Justify' 'Center')

     data(E1 L1'Policy number')(E2 L2'Issued')(C1 L3'Source')(Pltfm L4'Platform')
     data,(Ass L5'Assurer')(C3 L6'Product Type')(C4 L7'Product')(C2 L8'Status')

     {.Posn(fd+gap),+\10,10+12.Size}data                       line 'em up
     (data).Attach4'Top' 'Left'
     Datadata
     'C'#.INPUT.PaintLabels Data

     'G1'WC'Group' 'Policyholder'
     G1 #.INPUT.MakeLabels 4
     :With G1
         Size(gap fd+.5)(100+gap 80+.2 1)
         Posnfd gap3 1

         'E1' 'Nino'WC'Label' ''BUT'Edit'IF isAdhoc                   Dob NINO

         :If isAdhoc''#.INPUT.ScreenData#.IPMiota'SEX01'                   Sex
             'C1'WC'Combo'('Items'#.INPUT.SexAlt)
         :Else
             'C1'WC'Label' ''
         :EndIf

         'E2'WC'Label' ''                                               RetirementAge

 >> button to go?
         'B1'WC'Button'('Style' 'Check')
         B1.(Hint Tip)'The policy is subject to divorce proceedings, earmarking or a pension-sharing order'
         B1.Visible0
 >>>>>>>>>>>>>>>

        (E1 E2 C1 B1).Posn(fd++\gap+0 fd fd fd),gap+80                align fields
         (E1 E2 C1 Nino).Posn(fd++\gap+0 fd fd fd),gap+80              align fields
         E2.Posn+0 40                                                   shift right
         Data(E1 L1'Born')(C1 L2'Sex')
        Data,(E2 L3'Taking benefits at age')(B1 'Divorcing')
         Data,(E2 L3'Taking benefits at age')(Nino L4'Nat Ins No')
         'L'#.INPUT.PaintLabels Data

     :EndWith

     'G2'WC'Group' 'Funds'
     :With G2
         Size(gap fd+.5)(150)
         Posn0 gap+'TR'cnr ##.G1

         'B1' 'B2' 'B3'WC'Button'('Style' 'Check')
         Data(B1 'Funds in W/P')(B2 'Funds in PAF')(B3 'SafetyNet Funds')
         (Data).Posn(fd++\gap+0 fd fd),gap2                         L-aligned col
         'L'#.INPUT.PaintLabels Data
     :EndWith

     'G3'WC'Group' 'Payments'
     G3 #.INPUT.MakeLabels 4
     :With G3
         Size(gap fd+.5)(2+/100 gap 60 gap)
         Posn0 gap+'TR'cnr ##.G2

         'B2' 'B3'WC'Button'('Style' 'Check')
         'Lrpa'WC'Edit' ''(wid 80)                                        LastRegPmtAmt
         'Lrpd'WC'Edit' ''(wid 80)('ValidIfEmpty' 1)                      LastRegPmtDat
         'Lcdat' 'E4'WC'Label' ''(wid 80)                             Est Last Cntbn Date; TotFtrContbn

         xxNS''                                                        dummy

         ((B2 Lrpa)(B3 Lrpd)(xx E4)(xx Lcdat)).Posn(fd++\0 fd fd fd+gap).,50 240
         (B2 B3).Posn-0 30  nudge these buttons left

         Data(Lrpa L2'Last reg pmt amt')(Lrpd L3'Last reg pmt date')(E4 L4'Future contribution')
         Data,(B2 'Include ftr cntbns')(B3 'Annual Premium')(Lcdat L1'Final contribution to this policy')
         'L'#.INPUT.PaintLabels Data

         Lrpa.(Hint Tip)'Amount of the most recent regular payment'
         Lrpd.(Hint Tip)'Date of the most recent regular payment'
         E4.(Hint Tip)'Total projected future contributions to the policy'

         (Lrpa Lrpd E4).onChange'#.INPUT.HandleFtrContb'form
         B3.onSelect'#.INPUT.HandleFtrContb'form

     :EndWith

     'G4'WC'Group' 'Benefits'('Border' 0)
     G4 #.INPUT.MakeLabels 2
     :With G4
         Posngap+0,/'BL'cnr##.(G1 G2 G3)
         Size(gap fd+.2 2)(-/2'BR' 'BL'cnr##.(G3 G1))

         'E1'WC'Edit'(wid 80)                                           OrigNRD
         'E2'WC('Label'BUT'Edit'IF isAdhoc)(wid 80)                     Nrd
         'B1'WC'Button'('Style' 'Check')                                Death Benefit
         (E1 E2 B1).Posn(gap+fd),+\100+gap+0 80 80                     single line o'data

         Data(E1 L1'Original maturity')(E2 L2'Current maturity')(B1 'Death benefit')
         'L'#.INPUT.PaintLabels Data

     :EndWith

     (G1 G2 G3 G4).(Attach EdgeStyle)(4'Top' 'Left')('Recess')
     (G1 G2 G3 G4).FCol#.CONSTANTS.COLOURS.DKGREY

     (#.ValidatePP1POL){
         .Type oneOf'Combo' 'Button':.onSelect
         .onChange
     }'#.INPUT.HandleScreen17'form                                     everybody gets a callback

 :EndWith
 WriteScreen17 form
 :If qt#.CONSTANTS.QUOTETYPES.(L70 CUPAS ADHOC)
     #.BottomForm(1 2)('exit' 'help')((,'#.SVQ_EXIT')('#.SVQ_HELP' 900))
 :Else
     #.BottomForm(1 2 4)('exit' 'help' 'calc')((,'#.SVQ_EXIT')('#.SVQ_HELP' 900)('NQ ''#.Top'' 1003 ''Run Calculations'''))
 :EndIf
 ReDraw[sn]0