# InputValidationFormula

FormulaKeyword: Pr_Option_6
FormulaWithFunction: ((@Option_Value_6+ @Pr_PT) < 76)
FormulaBasic: ((@Option_Value_6+ @Pr_PT) < 76)
FormulaExtended: ((@Option_Value_6+ @Pr_PT) < 76)
ErrorMessage:
  Maximum Maturity Age for the product is 75 Years. Kindly revise secondary borrowers's age or Loan Tenure. 


# ProductMaster

ProductName: SUD Life Accidental Death and Total & Permanent Disability Benefit Rider - Traditional
ProductUIN: 142B005V01
Platform: 9
CurrentStatus: Approved
Description:
  A Traditional rider, which provides additional protection in case of unfortunate event of an accident


# Formulas

FormulaKeyword: [TAX_1]
FormulaWithFunction:
  (select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1')

FormulaBasic:
  (select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1')

FormulaExtended:
  (select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1')


FormulaKeyword: [MODAL_PREM]
FormulaWithFunction: Round(([ANN_PREM]*[MODE_DISC]),0)
FormulaBasic: Round(([ANN_PREM]*[MODE_DISC]),0)
FormulaExtended:
  Round(((((@PREM_RATE) * @Rd_SA)/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Rd_Id))),0)


FormulaKeyword: [LOAD_ANN_PREM]
FormulaWithFunction: [MODAL_PREM]*[MODE_FREQ]
FormulaBasic: [MODAL_PREM]*[MODE_FREQ]
FormulaExtended:
  (Round(((((@PREM_RATE) * @Rd_SA)/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Rd_Id))),0))*((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE))


FormulaKeyword: [ANN_PREM_YEARLY]
FormulaWithFunction: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Rd_PPT THEN [LOAD_ANN_PREM] ELSE 0 END)
FormulaBasic: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Rd_PPT THEN [LOAD_ANN_PREM] ELSE 0 END)
FormulaExtended:
  (CASE  WHEN PolicyYear  > 0 AND PolicyYear  <=@Rd_PPT THEN ((Round(((((@PREM_RATE) * @Rd_SA)/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Rd_Id))),0))*((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE))) ELSE 0 END)


FormulaKeyword: [CUM_PREM]
FormulaWithFunction: ([ANN_PREM]* (CASE WHEN PolicyYear < @Rd_PPT THEN PolicyYear else @Rd_PPT END))
FormulaBasic: ([ANN_PREM]* (CASE WHEN PolicyYear < @Rd_PPT THEN PolicyYear else @Rd_PPT END))
FormulaExtended:
  ((((@PREM_RATE) * @Rd_SA)/1000)* (CASE WHEN PolicyYear  < @Rd_PPT THEN PolicyYear  else @Rd_PPT END))


FormulaKeyword: [CUM_LOAD_PREM]
FormulaWithFunction: ([LOAD_ANN_PREM]* (CASE WHEN PolicyYear < @Rd_PPT THEN PolicyYear else @Rd_PPT END))
FormulaBasic: ([LOAD_ANN_PREM]* (CASE WHEN PolicyYear < @Rd_PPT THEN PolicyYear else @Rd_PPT END))
FormulaExtended:
  (((Round(((((@PREM_RATE) * @Rd_SA)/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Rd_Id))),0))*((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))* (CASE WHEN PolicyYear  < @Rd_PPT THEN PolicyYear  else @Rd_PPT END))


FormulaKeyword: [GSV_LTD]
FormulaWithFunction:
  (CASE WHEN (@Rd_PPT < 10 AND PolicyYear <= 2) OR (@Rd_PPT > 10 AND PolicyYear <= 3) THEN 0 ELSE (0.7 * [CUM_LOAD_PREM] * ((@Rd_PT - PolicyYear)/(@Rd_PT)) * (([CUM_LOAD_PREM])/(@Rd_PPT * [LOAD_ANN_PREM]))) END)

FormulaBasic:
  (CASE WHEN (@Rd_PPT < 10 AND PolicyYear <= 2) OR (@Rd_PPT > 10 AND PolicyYear <= 3) THEN 0 ELSE (0.7 * [CUM_LOAD_PREM] * ((@Rd_PT - PolicyYear)/(@Rd_PT)) * (([CUM_LOAD_PREM])/(@Rd_PPT * [LOAD_ANN_PREM]))) END)

FormulaExtended:
  (CASE WHEN (@Rd_PPT < 10 AND PolicyYear <= 2) OR (@Rd_PPT > 10 AND PolicyYear <= 3) THEN 0 ELSE (0.7 * ((((Round(((((@PREM_RATE) * @Rd_SA)/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Rd_Id))),0))*((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))* (CASE WHEN PolicyYear  < @Rd_PPT THEN PolicyYear  else @Rd_PPT END))) * ((@Rd_PT - PolicyYear)/(@Rd_PT)) * ((((((Round(((((@PREM_RATE) * @Rd_SA)/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Rd_Id))),0))*((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))* (CASE WHEN PolicyYear  < @Rd_PPT THEN PolicyYear  else @Rd_PPT END))))/(@Rd_PPT * ((Round(((((@PREM_RATE) * @Rd_SA)/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Rd_Id))),0))*((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))))) END)


FormulaKeyword: [GSV]
FormulaWithFunction:
  (CASE WHEN @Rd_PT = @Rd_PPT THEN 0 WHEN @Rd_PPT  = 1 THEN (0.7* [LOAD_ANN_PREM] * (@Rd_PT - PolicyYear)/(@Rd_PT)) ELSE [GSV_LTD] END)

FormulaBasic:
  (CASE WHEN @Rd_PT = @Rd_PPT THEN 0 WHEN @Rd_PPT  = 1 THEN (0.7* [LOAD_ANN_PREM] * (@Rd_PT - PolicyYear)/(@Rd_PT)) ELSE [GSV_LTD] END)

FormulaExtended:
  (CASE WHEN @Rd_PT = @Rd_PPT THEN 0 WHEN @Rd_PPT  = 1 THEN (0.7* ((Round(((((@PREM_RATE) * @Rd_SA)/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Rd_Id))),0))*((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE))) * (@Rd_PT - PolicyYear)/(@Rd_PT)) ELSE ((CASE WHEN (@Rd_PPT < 10 AND PolicyYear <= 2) OR (@Rd_PPT > 10 AND PolicyYear <= 3) THEN 0 ELSE (0.7 * ((((Round(((((@PREM_RATE) * @Rd_SA)/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Rd_Id))),0))*((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))* (CASE WHEN PolicyYear  < @Rd_PPT THEN PolicyYear  else @Rd_PPT END))) * ((@Rd_PT - PolicyYear)/(@Rd_PT)) * ((((((Round(((((@PREM_RATE) * @Rd_SA)/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Rd_Id))),0))*((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))* (CASE WHEN PolicyYear  < @Rd_PPT THEN PolicyYear  else @Rd_PPT END))))/(@Rd_PPT * ((Round(((((@PREM_RATE) * @Rd_SA)/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Rd_Id))),0))*((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))))) END)) END)


FormulaKeyword: [PremiumRate]
FormulaWithFunction:
  (SELECT RATE FROM Premiumrates where ProductId = @Rd_Id AND PT = @Rd_PT AND PPT = @Rd_PPT AND LAAGE = @LI_Entry_Age)

FormulaBasic:
  (SELECT RATE FROM Premiumrates where ProductId = @Rd_Id AND PT = @Rd_PT AND PPT = @Rd_PPT AND LAAGE = @LI_Entry_Age)

FormulaExtended:
  (SELECT RATE FROM Premiumrates where ProductId = @Rd_Id AND PT = @Rd_PT AND PPT = @Rd_PPT AND LAAGE = @LI_Entry_Age)


FormulaKeyword: [TAX_MP]
FormulaWithFunction: ROUND(([MODAL_PREM] * [TAX_1]),0)
FormulaBasic: ROUND(([MODAL_PREM] * [TAX_1]),0)
FormulaExtended:
  ROUND(((Round(((((@PREM_RATE) * @Rd_SA)/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Rd_Id))),0)) * ((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))),0)


FormulaKeyword: [MODAL_PREM_TAX]
FormulaWithFunction: ([MODAL_PREM]) + [TAX_MP]
FormulaBasic: ([MODAL_PREM]) + [TAX_MP]
FormulaExtended:
  ((Round(((((@PREM_RATE) * @Rd_SA)/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Rd_Id))),0))) + (ROUND(((Round(((((@PREM_RATE) * @Rd_SA)/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Rd_Id))),0)) * ((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))),0))


FormulaKeyword: [TAX_MP]
FormulaWithFunction: ROUND(([MODAL_PREM] * [TAX_1]),0)
FormulaBasic: ROUND(([MODAL_PREM] * [TAX_1]),0)
FormulaExtended:
  ROUND(((Round(((((@PREM_RATE) * @Rd_SA)/1000)*(@MODE_DISC)),0)) * ((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))),0)


FormulaKeyword: [MODAL_PREM_TAX]
FormulaWithFunction: ([MODAL_PREM]) + [TAX_MP]
FormulaBasic: ([MODAL_PREM]) + [TAX_MP]
FormulaExtended:
  ((Round(((((@PREM_RATE) * @Rd_SA)/1000)*(@MODE_DISC)),0))) + (ROUND(((Round(((((@PREM_RATE) * @Rd_SA)/1000)*(@MODE_DISC)),0)) * ((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))),0))


FormulaKeyword: [ANN_PREM_YEARLY]
FormulaWithFunction: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Rd_PPT THEN [LOAD_ANN_PREM] ELSE 0 END)
FormulaBasic: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Rd_PPT THEN [LOAD_ANN_PREM] ELSE 0 END)
FormulaExtended:
  (CASE  WHEN PolicyYear  > 0 AND PolicyYear  <=@Rd_PPT THEN ((Round(((((@PREM_RATE) * @Rd_SA)/1000)*(@MODE_DISC)),0))*(@MODE_FREQ)) ELSE 0 END)


FormulaKeyword: [CUM_LOAD_PREM]
FormulaWithFunction: ([LOAD_ANN_PREM]* (CASE WHEN PolicyYear < @Rd_PPT THEN PolicyYear else @Rd_PPT END))
FormulaBasic: ([LOAD_ANN_PREM]* (CASE WHEN PolicyYear < @Rd_PPT THEN PolicyYear else @Rd_PPT END))
FormulaExtended:
  (((Round(((((@PREM_RATE) * @Rd_SA)/1000)*(@MODE_DISC)),0))*(@MODE_FREQ))* (CASE WHEN PolicyYear  < @Rd_PPT THEN PolicyYear  else @Rd_PPT END))


FormulaKeyword: [GSV_LTD]
FormulaWithFunction:
  (CASE WHEN (@Rd_PPT < 10 AND PolicyYear <= 2) OR (@Rd_PPT > 10 AND PolicyYear <= 3) THEN 0 ELSE (0.6 * [CUM_LOAD_PREM] * ((@Rd_PT - PolicyYear)/(@Rd_PT)) * (([CUM_LOAD_PREM])/(@Rd_PPT * [LOAD_ANN_PREM]))) END)

FormulaBasic:
  (CASE WHEN (@Rd_PPT < 10 AND PolicyYear <= 2) OR (@Rd_PPT > 10 AND PolicyYear <= 3) THEN 0 ELSE (0.6 * [CUM_LOAD_PREM] * ((@Rd_PT - PolicyYear)/(@Rd_PT)) * (([CUM_LOAD_PREM])/(@Rd_PPT * [LOAD_ANN_PREM]))) END)

FormulaExtended:
  (CASE WHEN (@Rd_PPT < 10 AND PolicyYear <= 2) OR (@Rd_PPT > 10 AND PolicyYear <= 3) THEN 0 ELSE (0.6 * ((((Round(((((@PREM_RATE) * @Rd_SA)/1000)*(@MODE_DISC)),0))*(@MODE_FREQ))* (CASE WHEN PolicyYear  < @Rd_PPT THEN PolicyYear  else @Rd_PPT END))) * ((@Rd_PT - PolicyYear)/(@Rd_PT)) * ((((((Round(((((@PREM_RATE) * @Rd_SA)/1000)*(@MODE_DISC)),0))*(@MODE_FREQ))* (CASE WHEN PolicyYear  < @Rd_PPT THEN PolicyYear  else @Rd_PPT END))))/(@Rd_PPT * ((Round(((((@PREM_RATE) * @Rd_SA)/1000)*(@MODE_DISC)),0))*(@MODE_FREQ))))) END)


FormulaKeyword: [GSV]
FormulaWithFunction:
  (CASE WHEN @Rd_PT = @Rd_PPT THEN 0 WHEN @Rd_PPT  = 1 THEN (0.6 * [LOAD_ANN_PREM] * (@Rd_PT - PolicyYear)/(@Rd_PT)) ELSE [GSV_LTD] END)

FormulaBasic:
  (CASE WHEN @Rd_PT = @Rd_PPT THEN 0 WHEN @Rd_PPT  = 1 THEN (0.6 * [LOAD_ANN_PREM] * (@Rd_PT - PolicyYear)/(@Rd_PT)) ELSE [GSV_LTD] END)

FormulaExtended:
  (CASE WHEN @Rd_PT = @Rd_PPT THEN 0 WHEN @Rd_PPT  = 1 THEN (0.6 * ((Round(((((@PREM_RATE) * @Rd_SA)/1000)*(@MODE_DISC)),0))*(@MODE_FREQ)) * (@Rd_PT - PolicyYear)/(@Rd_PT)) ELSE ((CASE WHEN (@Rd_PPT < 10 AND PolicyYear <= 2) OR (@Rd_PPT > 10 AND PolicyYear <= 3) THEN 0 ELSE (0.6 * ((((Round(((((@PREM_RATE) * @Rd_SA)/1000)*(@MODE_DISC)),0))*(@MODE_FREQ))* (CASE WHEN PolicyYear  < @Rd_PPT THEN PolicyYear  else @Rd_PPT END))) * ((@Rd_PT - PolicyYear)/(@Rd_PT)) * ((((((Round(((((@PREM_RATE) * @Rd_SA)/1000)*(@MODE_DISC)),0))*(@MODE_FREQ))* (CASE WHEN PolicyYear  < @Rd_PPT THEN PolicyYear  else @Rd_PPT END))))/(@Rd_PPT * ((Round(((((@PREM_RATE) * @Rd_SA)/1000)*(@MODE_DISC)),0))*(@MODE_FREQ))))) END)) END)


FormulaKeyword: [PREM_RATE_TAX]
FormulaWithFunction: (@Prem_Rate*(1+[TAX_1]))/1000
FormulaBasic: (@Prem_Rate*(1+[TAX_1]))/1000
FormulaExtended:
  (@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000


FormulaKeyword: [SA]
FormulaWithFunction:
  min(CEILING((([LOAN_AMT] + (CASE WHEN @Pr_OPTION_6 = 61 THEN (([LOAN_AMT]*[PREM_RATE_TAX])*(1-Power([PREM_RATE_TAX],@Pr_PT)))/(1-[PREM_RATE_TAX]) ELSE 0 END))/1000))*1000,50000000)

FormulaBasic:
  (SELECT MIN(v) FROM (VALUES (CEILING((([LOAN_AMT] + (CASE WHEN @Pr_OPTION_6 = 61 THEN (([LOAN_AMT]*[PREM_RATE_TAX])*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), [PREM_RATE_TAX]), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-[PREM_RATE_TAX]) ELSE 0 END))/1000))*1000),(50000000)) AS value(v))

FormulaExtended:
  (SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v))


FormulaKeyword: [HSAD]
FormulaWithFunction:
  Round(((SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and [SA] between FromSa AND ToSa)*((@Prem_Rate)*[SA]))/1000,2)

FormulaBasic:
  Round(((SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and [SA] between FromSa AND ToSa)*((@Prem_Rate)*[SA]))/1000,2)

FormulaExtended:
  Round(((SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v))) between FromSa AND ToSa)*((@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v)))))/1000,2)


FormulaKeyword: [ANN_PREM]
FormulaWithFunction: Round((Round((((@Prem_Rate)*[SA])/1000),0)-[HSAD]),0)
FormulaBasic: Round((Round((((@Prem_Rate)*[SA])/1000),0)-[HSAD]),0)
FormulaExtended:
  Round((Round((((@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v))))/1000),0)-(Round(((SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v))) between FromSa AND ToSa)*((@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v)))))/1000,2))),0)


FormulaKeyword: [MODAL_PREM]
FormulaWithFunction: [ANN_PREM]
FormulaBasic: [ANN_PREM]
FormulaExtended:
  (Round((Round((((@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v))))/1000),0)-(Round(((SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v))) between FromSa AND ToSa)*((@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v)))))/1000,2))),0))


FormulaKeyword: [MODAL_PREM_TAX]
FormulaWithFunction: ([MODAL_PREM]) + [TAX_MP]
FormulaBasic: ([MODAL_PREM]) + [TAX_MP]
FormulaExtended:
  (((Round((Round((((@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v))))/1000),0)-(Round(((SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v))) between FromSa AND ToSa)*((@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v)))))/1000,2))),0)))) + (ROUND((((Round((Round((((@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v))))/1000),0)-(Round(((SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v))) between FromSa AND ToSa)*((@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v)))))/1000,2))),0))) * ((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))),2))


FormulaKeyword: [ANN_PREM_YEARLY]
FormulaWithFunction: (CASE WHEN PolicyYear <= 1 THEN [ANN_PREM] ELSE 0 END)
FormulaBasic: (CASE WHEN PolicyYear <= 1 THEN [ANN_PREM] ELSE 0 END)
FormulaExtended:
  (CASE WHEN PolicyYear <= 1 THEN (Round((Round((((@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v))))/1000),0)-(Round(((SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v))) between FromSa AND ToSa)*((@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((@Pr_Loan_Amt)) + (CASE WHEN @Pr_OPTION_6 = 61 THEN ((((@Pr_Loan_Amt))*((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))*(1-(SELECT POWER(CONVERT(DECIMAL(16,14), ((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)), CONVERT(DECIMAL(16,14),@Pr_PT)))))/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)) ELSE 0 END))/1000))*1000),(50000000)) AS value(v)))))/1000,2))),0)) ELSE 0 END)


FormulaKeyword: [PremiumRate]
FormulaWithFunction:
  (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT and Optionid = ((@Pr_Option_2) -12+(@Pr_Option_3)-21) and SMOKING =(CASE WHEN @Pr_Option_3= 21 THEN 60 ELSE @Pr_OPTION_5 END ) AND Field1 = @Pr_OPTION_1+7)

FormulaBasic:
  (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT and Optionid = ((@Pr_Option_2) -12+(@Pr_Option_3)-21) and SMOKING =(CASE WHEN @Pr_Option_3= 21 THEN 60 ELSE @Pr_OPTION_5 END ) AND Field1 = @Pr_OPTION_1+7)

FormulaExtended:
  (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT and Optionid = ((@Pr_Option_2) -12+(@Pr_Option_3)-21) and SMOKING =(CASE WHEN @Pr_Option_3= 21 THEN 60 ELSE @Pr_OPTION_5 END ) AND Field1 = @Pr_OPTION_1+7)


FormulaKeyword: [NSAP_VAL]
FormulaWithFunction: ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * [SA] /1000 ELSE 0 END) * [MODE_DISC],2,1)
FormulaBasic: ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * [SA] /1000 ELSE 0 END) * [MODE_DISC],2,1)
FormulaExtended:
  ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * ((CEILING(((((@PREM_RATE) * (@Option_Value_3))/1000))*(@Pr_PPT+1)/1000)*1000)) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1)


FormulaKeyword: [MODAL_PREM_WNSAP]
FormulaWithFunction: ROUND(([ANN_PREM]*[MODE_DISC]),2,1)
FormulaBasic: ROUND(([ANN_PREM]*[MODE_DISC]),2,1)
FormulaExtended:
  ROUND(((((@PREM_RATE) * (@Option_Value_3))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)


FormulaKeyword: [MODAL_PREM]
FormulaWithFunction: ROUND(([MODAL_PREM_WNSAP] + [NSAP_VAL]),0)
FormulaBasic: ROUND(([MODAL_PREM_WNSAP] + [NSAP_VAL]),0)
FormulaExtended:
  ROUND(((ROUND(((((@PREM_RATE) * (@Option_Value_3))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * ((CEILING(((((@PREM_RATE) * (@Option_Value_3))/1000))*(@Pr_PPT+1)/1000)*1000)) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)


FormulaKeyword: [TAX_MP]
FormulaWithFunction: ROUND(([MODAL_PREM] * [TAX_1]),0)
FormulaBasic: ROUND(([MODAL_PREM] * [TAX_1]),0)
FormulaExtended:
  ROUND(((ROUND(((ROUND(((((@PREM_RATE) * (@Option_Value_3))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * ((CEILING(((((@PREM_RATE) * (@Option_Value_3))/1000))*(@Pr_PPT+1)/1000)*1000)) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)) * ((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))),0)


FormulaKeyword: [MODAL_PREM_TAX]
FormulaWithFunction: ([MODAL_PREM]) + [TAX_MP]
FormulaBasic: ([MODAL_PREM]) + [TAX_MP]
FormulaExtended:
  ((ROUND(((ROUND(((((@PREM_RATE) * (@Option_Value_3))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * ((CEILING(((((@PREM_RATE) * (@Option_Value_3))/1000))*(@Pr_PPT+1)/1000)*1000)) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0))) + (ROUND(((ROUND(((ROUND(((((@PREM_RATE) * (@Option_Value_3))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * ((CEILING(((((@PREM_RATE) * (@Option_Value_3))/1000))*(@Pr_PPT+1)/1000)*1000)) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)) * ((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))),0))


FormulaKeyword: [LOAD_ANN_PREM]
FormulaWithFunction: (ROUND([MODAL_PREM_WNSAP],0))*([MODE_FREQ])
FormulaBasic: (ROUND([MODAL_PREM_WNSAP],0))*([MODE_FREQ])
FormulaExtended:
  (ROUND((ROUND(((((@PREM_RATE) * (@Option_Value_3))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))


FormulaKeyword: [LOAD_ANN_PREM_NSAP]
FormulaWithFunction: ([MODAL_PREM])*([MODE_FREQ])
FormulaBasic: ([MODAL_PREM])*([MODE_FREQ])
FormulaExtended:
  ((ROUND(((ROUND(((((@PREM_RATE) * (@Option_Value_3))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * ((CEILING(((((@PREM_RATE) * (@Option_Value_3))/1000))*(@Pr_PPT+1)/1000)*1000)) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))


FormulaKeyword: [ANN_PREM_YEARLY]
FormulaWithFunction: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Pr_PPT THEN [LOAD_ANN_PREM] ELSE 0 END)
FormulaBasic: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Pr_PPT THEN [LOAD_ANN_PREM] ELSE 0 END)
FormulaExtended:
  (CASE  WHEN PolicyYear  > 0 AND PolicyYear  <=@Pr_PPT THEN ((ROUND((ROUND(((((@PREM_RATE) * (@Option_Value_3))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))) ELSE 0 END)


FormulaKeyword: [ANN_PREM_YEARLY_NSAP]
FormulaWithFunction: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Pr_PPT THEN [LOAD_ANN_PREM_NSAP] ELSE 0 END)
FormulaBasic: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Pr_PPT THEN [LOAD_ANN_PREM_NSAP] ELSE 0 END)
FormulaExtended:
  (CASE  WHEN PolicyYear  > 0 AND PolicyYear  <=@Pr_PPT THEN (((ROUND(((ROUND(((((@PREM_RATE) * (@Option_Value_3))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * ((CEILING(((((@PREM_RATE) * (@Option_Value_3))/1000))*(@Pr_PPT+1)/1000)*1000)) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))) ELSE 0 END)


FormulaKeyword: [CUM_LOAD_PREM]
FormulaWithFunction: ([LOAD_ANN_PREM]* (CASE WHEN PolicyYear < @Pr_PPT THEN PolicyYear else @Pr_PPT END))
FormulaBasic: ([LOAD_ANN_PREM]* (CASE WHEN PolicyYear < @Pr_PPT THEN PolicyYear else @Pr_PPT END))
FormulaExtended:
  (((ROUND((ROUND(((((@PREM_RATE) * (@Option_Value_3))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE))))* (CASE WHEN PolicyYear  < @Pr_PPT THEN PolicyYear  else @Pr_PPT END))


FormulaKeyword: [Ann_Payout]
FormulaWithFunction: (CASE WHEN PolicyYear > ((@Pr_PPT)+[DEFER_PERIOD]) THEN (@Option_Value_3) ELSE 0 END)
FormulaBasic: (CASE WHEN PolicyYear > ((@Pr_PPT)+[DEFER_PERIOD]) THEN (@Option_Value_3) ELSE 0 END)
FormulaExtended:
  (CASE WHEN PolicyYear > ((@Pr_PPT)+((CASE WHEN @Pr_Option_1=1 THEN 0 ELSE 5 END))) THEN (@Option_Value_3) ELSE 0 END)


FormulaKeyword: [MB_G]
FormulaWithFunction:
  (CASE WHEN PolicyYear  = (@Pr_PT) THEN ROUND(((@Pr_PPT)*[MODAL_PREM_WNSAP]*[MODE_FREQ]),0) ELSE 0 END)

FormulaBasic:
  (CASE WHEN PolicyYear  = (@Pr_PT) THEN ROUND(((@Pr_PPT)*[MODAL_PREM_WNSAP]*[MODE_FREQ]),0) ELSE 0 END)

FormulaExtended:
  (CASE WHEN PolicyYear  = (@Pr_PT) THEN ROUND(((@Pr_PPT)*(ROUND(((((@PREM_RATE) * (@Option_Value_3))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1))*((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE))),0) ELSE 0 END)


FormulaKeyword: [SB_G]
FormulaWithFunction: [Ann_Payout]+[MB_G]
FormulaBasic: [Ann_Payout]+[MB_G]
FormulaExtended:
  ((CASE WHEN PolicyYear > ((@Pr_PPT)+((CASE WHEN @Pr_Option_1=1 THEN 0 ELSE 5 END))) THEN (@Option_Value_3) ELSE 0 END))+((CASE WHEN PolicyYear  = (@Pr_PT) THEN ROUND(((@Pr_PPT)*(ROUND(((((@PREM_RATE) * (@Option_Value_3))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1))*((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE))),0) ELSE 0 END))


FormulaKeyword: [GSV]
FormulaExtended: 1
FormulaWithFunction:
  (CASE WHEN PolicyYear < @Pr_PT THEN  (((SELECT RATE FROM GSV where ProductId = @Pr_Id AND PolicyYear = FromYear AND PT = @Pr_PT AND PPT = @Pr_PPT) * [CUM_LOAD_PREM]) - [ACCR_BEN]) ELSE 0 END)

FormulaBasic:
  (CASE WHEN PolicyYear < @Pr_PT THEN  (((SELECT RATE FROM GSV where ProductId = @Pr_Id AND PolicyYear = FromYear AND PT = @Pr_PT AND PPT = @Pr_PPT) * [CUM_LOAD_PREM]) - [ACCR_BEN]) ELSE 0 END)


FormulaKeyword: [PremiumRate]
FormulaWithFunction:
  (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT AND PPT = @Pr_PPT AND optionid = @Pr_Option_1)

FormulaBasic:
  (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT AND PPT = @Pr_PPT AND optionid = @Pr_Option_1)

FormulaExtended:
  (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT AND PPT = @Pr_PPT AND optionid = @Pr_Option_1)


FormulaKeyword: [PR_PT]
FormulaWithFunction:
  @Pr_PPT + (CASE WHEN @Pr_Option_1=1 THEN 0 ELSE 5 END) + (CASE WHEN (@Pr_Option_2=3 OR  @Pr_Option_2=7) THEN 10 WHEN (@Pr_Option_2=4 OR  @Pr_Option_2=8) THEN 15 WHEN (@Pr_Option_2=6) THEN 25 ELSE 20 END) 

FormulaBasic:
  @Pr_PPT + (CASE WHEN @Pr_Option_1=1 THEN 0 ELSE 5 END) + (CASE WHEN (@Pr_Option_2=3 OR  @Pr_Option_2=7) THEN 10 WHEN (@Pr_Option_2=4 OR  @Pr_Option_2=8) THEN 15 WHEN (@Pr_Option_2=6) THEN 25 ELSE 20 END) 

FormulaExtended:
  @Pr_PPT + (CASE WHEN @Pr_Option_1=1 THEN 0 ELSE 5 END) + (CASE WHEN (@Pr_Option_2=3 OR  @Pr_Option_2=7) THEN 10 WHEN (@Pr_Option_2=4 OR  @Pr_Option_2=8) THEN 15 WHEN (@Pr_Option_2=6) THEN 25 ELSE 20 END) 


FormulaKeyword: [NSAP_VAL]
FormulaWithFunction: ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * [SA] /1000 ELSE 0 END) * [MODE_DISC],2,1)
FormulaBasic: ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * [SA] /1000 ELSE 0 END) * [MODE_DISC],2,1)
FormulaExtended:
  ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * ((CEILING(((((@PREM_RATE) * (@Option_Value_1))/1000))*(11)/1000)*1000)) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1)


FormulaKeyword: [MODAL_PREM_WNSAP]
FormulaWithFunction: ROUND(([ANN_PREM]*[MODE_DISC]),2,1)
FormulaBasic: ROUND(([ANN_PREM]*[MODE_DISC]),2,1)
FormulaExtended:
  ROUND(((((@PREM_RATE) * (@Option_Value_1))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)


FormulaKeyword: [MODAL_PREM]
FormulaWithFunction: ROUND(([MODAL_PREM_WNSAP] + [NSAP_VAL]),0)
FormulaBasic: ROUND(([MODAL_PREM_WNSAP] + [NSAP_VAL]),0)
FormulaExtended:
  ROUND(((ROUND(((((@PREM_RATE) * (@Option_Value_1))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * ((CEILING(((((@PREM_RATE) * (@Option_Value_1))/1000))*(11)/1000)*1000)) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)


FormulaKeyword: [TAX_MP]
FormulaWithFunction: ROUND(([MODAL_PREM] * [TAX_1]),0)
FormulaBasic: ROUND(([MODAL_PREM] * [TAX_1]),0)
FormulaExtended:
  ROUND(((ROUND(((ROUND(((((@PREM_RATE) * (@Option_Value_1))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * ((CEILING(((((@PREM_RATE) * (@Option_Value_1))/1000))*(11)/1000)*1000)) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)) * ((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))),0)


FormulaKeyword: [MODAL_PREM_TAX]
FormulaWithFunction: ([MODAL_PREM]) + [TAX_MP]
FormulaBasic: ([MODAL_PREM]) + [TAX_MP]
FormulaExtended:
  ((ROUND(((ROUND(((((@PREM_RATE) * (@Option_Value_1))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * ((CEILING(((((@PREM_RATE) * (@Option_Value_1))/1000))*(11)/1000)*1000)) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0))) + (ROUND(((ROUND(((ROUND(((((@PREM_RATE) * (@Option_Value_1))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * ((CEILING(((((@PREM_RATE) * (@Option_Value_1))/1000))*(11)/1000)*1000)) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)) * ((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))),0))


FormulaKeyword: [LOAD_ANN_PREM]
FormulaWithFunction: (ROUND([MODAL_PREM_WNSAP],0))*([MODE_FREQ])
FormulaBasic: (ROUND([MODAL_PREM_WNSAP],0))*([MODE_FREQ])
FormulaExtended:
  (ROUND((ROUND(((((@PREM_RATE) * (@Option_Value_1))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))


FormulaKeyword: [LOAD_ANN_PREM_NSAP]
FormulaWithFunction: ([MODAL_PREM])*([MODE_FREQ])
FormulaBasic: ([MODAL_PREM])*([MODE_FREQ])
FormulaExtended:
  ((ROUND(((ROUND(((((@PREM_RATE) * (@Option_Value_1))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * ((CEILING(((((@PREM_RATE) * (@Option_Value_1))/1000))*(11)/1000)*1000)) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))


FormulaKeyword: [ANN_PREM_YEARLY]
FormulaWithFunction: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Pr_PPT THEN [LOAD_ANN_PREM] ELSE 0 END)
FormulaBasic: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Pr_PPT THEN [LOAD_ANN_PREM] ELSE 0 END)
FormulaExtended:
  (CASE  WHEN PolicyYear  > 0 AND PolicyYear  <=@Pr_PPT THEN ((ROUND((ROUND(((((@PREM_RATE) * (@Option_Value_1))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))) ELSE 0 END)


FormulaKeyword: [ANN_PREM_YEARLY_NSAP]
FormulaWithFunction: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Pr_PPT THEN [LOAD_ANN_PREM_NSAP] ELSE 0 END)
FormulaBasic: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Pr_PPT THEN [LOAD_ANN_PREM_NSAP] ELSE 0 END)
FormulaExtended:
  (CASE  WHEN PolicyYear  > 0 AND PolicyYear  <=@Pr_PPT THEN (((ROUND(((ROUND(((((@PREM_RATE) * (@Option_Value_1))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * ((CEILING(((((@PREM_RATE) * (@Option_Value_1))/1000))*(11)/1000)*1000)) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))) ELSE 0 END)


FormulaKeyword: [CUM_LOAD_PREM]
FormulaWithFunction: ([LOAD_ANN_PREM]* (CASE WHEN PolicyYear < @Pr_PPT THEN PolicyYear else @Pr_PPT END))
FormulaBasic: ([LOAD_ANN_PREM]* (CASE WHEN PolicyYear < @Pr_PPT THEN PolicyYear else @Pr_PPT END))
FormulaExtended:
  (((ROUND((ROUND(((((@PREM_RATE) * (@Option_Value_1))/1000)*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE))))* (CASE WHEN PolicyYear  < @Pr_PPT THEN PolicyYear  else @Pr_PPT END))


FormulaKeyword: [Ann_Payout]
FormulaWithFunction:
  (CASE WHEN PolicyYear > ((@Pr_PPT)*2) and PolicyYear < (@Pr_PT)  THEN (5 * @Option_Value_1 ) ELSE 0 END)

FormulaBasic:
  (CASE WHEN PolicyYear > ((@Pr_PPT)*2) and PolicyYear < (@Pr_PT)  THEN (5 * @Option_Value_1 ) ELSE 0 END)

FormulaExtended:
  (CASE WHEN PolicyYear > ((@Pr_PPT)*2) and PolicyYear < (@Pr_PT)  THEN (5 * @Option_Value_1 ) ELSE 0 END)


FormulaKeyword: [Monthly_Payout]
FormulaWithFunction:
  (CASE WHEN PolicyYear > ((@Pr_PPT)*2) and PolicyYear <= (@Pr_PT)  THEN (12 * @Option_Value_1 ) ELSE 0 END)

FormulaBasic:
  (CASE WHEN PolicyYear > ((@Pr_PPT)*2) and PolicyYear <= (@Pr_PT)  THEN (12 * @Option_Value_1 ) ELSE 0 END)

FormulaExtended:
  (CASE WHEN PolicyYear > ((@Pr_PPT)*2) and PolicyYear <= (@Pr_PT)  THEN (12 * @Option_Value_1 ) ELSE 0 END)


FormulaKeyword: [MB_G]
FormulaWithFunction:
  (CASE WHEN PolicyYear  = (@Pr_PT) THEN ((CASE WHEN @Pr_PPT = 5 THEN 40 ELSE 60 END) * (@Option_Value_1)) ELSE 0 END)

FormulaBasic:
  (CASE WHEN PolicyYear  = (@Pr_PT) THEN ((CASE WHEN @Pr_PPT = 5 THEN 40 ELSE 60 END) * (@Option_Value_1)) ELSE 0 END)

FormulaExtended:
  (CASE WHEN PolicyYear  = (@Pr_PT) THEN ((CASE WHEN @Pr_PPT = 5 THEN 40 ELSE 60 END) * (@Option_Value_1)) ELSE 0 END)


FormulaKeyword: [SB_G]
FormulaWithFunction: [Ann_Payout]+[Monthly_Payout]+[MB_G]
FormulaBasic: [Ann_Payout]+[Monthly_Payout]+[MB_G]
FormulaExtended:
  ((CASE WHEN PolicyYear > ((@Pr_PPT)*2) and PolicyYear < (@Pr_PT)  THEN (5 * @Option_Value_1 ) ELSE 0 END))+((CASE WHEN PolicyYear > ((@Pr_PPT)*2) and PolicyYear <= (@Pr_PT)  THEN (12 * @Option_Value_1 ) ELSE 0 END))+((CASE WHEN PolicyYear  = (@Pr_PT) THEN ((CASE WHEN @Pr_PPT = 5 THEN 40 ELSE 60 END) * (@Option_Value_1)) ELSE 0 END))


FormulaKeyword: [PremiumRate]
FormulaWithFunction:
  (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT AND PPT = @Pr_PPT)

FormulaBasic:
  (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT AND PPT = @Pr_PPT)

FormulaExtended:
  (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT AND PPT = @Pr_PPT)


FormulaKeyword: [ANN_PREM]
FormulaWithFunction: (((@PREM_RATE - [HSAD_Rate]) * (@Pr_SA))/1000)
FormulaBasic: (((@PREM_RATE - [HSAD_Rate]) * (@Pr_SA))/1000)
FormulaExtended:
  (((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000)


FormulaKeyword: [NSAP_VAL]
FormulaWithFunction: ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * (@Pr_SA) /1000 ELSE 0 END) * [MODE_DISC],2,1)
FormulaBasic: ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * (@Pr_SA) /1000 ELSE 0 END) * [MODE_DISC],2,1)
FormulaExtended:
  ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * (@Pr_SA) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1)


FormulaKeyword: [MODAL_PREM_WNSAP]
FormulaWithFunction: ROUND(([ANN_PREM]*[MODE_DISC]),2,1)
FormulaBasic: ROUND(([ANN_PREM]*[MODE_DISC]),2,1)
FormulaExtended:
  ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)


FormulaKeyword: [MODAL_PREM]
FormulaWithFunction: ROUND(([MODAL_PREM_WNSAP] + [NSAP_VAL]),0)
FormulaBasic: ROUND(([MODAL_PREM_WNSAP] + [NSAP_VAL]),0)
FormulaExtended:
  ROUND(((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * (@Pr_SA) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)


FormulaKeyword: [TAX_MP]
FormulaWithFunction: ROUND(([MODAL_PREM] * [TAX_1]),0)
FormulaBasic: ROUND(([MODAL_PREM] * [TAX_1]),0)
FormulaExtended:
  ROUND(((ROUND(((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * (@Pr_SA) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)) * ((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))),0)


FormulaKeyword: [MODAL_PREM_TAX]
FormulaWithFunction: ([MODAL_PREM]) + [TAX_MP]
FormulaBasic: ([MODAL_PREM]) + [TAX_MP]
FormulaExtended:
  ((ROUND(((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * (@Pr_SA) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0))) + (ROUND(((ROUND(((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * (@Pr_SA) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)) * ((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))),0))


FormulaKeyword: [LOAD_ANN_PREM]
FormulaWithFunction: (ROUND([MODAL_PREM_WNSAP],0))*([MODE_FREQ])
FormulaBasic: (ROUND([MODAL_PREM_WNSAP],0))*([MODE_FREQ])
FormulaExtended:
  (ROUND((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))


FormulaKeyword: [LOAD_ANN_PREM_NSAP]
FormulaWithFunction: ([MODAL_PREM])*([MODE_FREQ])
FormulaBasic: ([MODAL_PREM])*([MODE_FREQ])
FormulaExtended:
  ((ROUND(((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * (@Pr_SA) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))


FormulaKeyword: [ANN_PREM_YEARLY]
FormulaWithFunction: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Pr_PPT THEN [LOAD_ANN_PREM] ELSE 0 END)
FormulaBasic: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Pr_PPT THEN [LOAD_ANN_PREM] ELSE 0 END)
FormulaExtended:
  (CASE  WHEN PolicyYear  > 0 AND PolicyYear  <=@Pr_PPT THEN ((ROUND((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))) ELSE 0 END)


FormulaKeyword: [ANN_PREM_YEARLY_NSAP]
FormulaWithFunction: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Pr_PPT THEN [LOAD_ANN_PREM_NSAP] ELSE 0 END)
FormulaBasic: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Pr_PPT THEN [LOAD_ANN_PREM_NSAP] ELSE 0 END)
FormulaExtended:
  (CASE  WHEN PolicyYear  > 0 AND PolicyYear  <=@Pr_PPT THEN (((ROUND(((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * (@Pr_SA) /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))) ELSE 0 END)


FormulaKeyword: [CUM_LOAD_PREM]
FormulaWithFunction: ([LOAD_ANN_PREM]* (CASE WHEN PolicyYear < @Pr_PPT THEN PolicyYear else @Pr_PPT END))
FormulaBasic: ([LOAD_ANN_PREM]* (CASE WHEN PolicyYear < @Pr_PPT THEN PolicyYear else @Pr_PPT END))
FormulaExtended:
  (((ROUND((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE))))* (CASE WHEN PolicyYear  < @Pr_PPT THEN PolicyYear  else @Pr_PPT END))


FormulaKeyword: [DB_G]
FormulaWithFunction: Max(@Pr_SA,10*[ANN_PREM] ,1.05*[CUM_LOAD_PREM])
FormulaBasic: (SELECT MAX(v) FROM (VALUES (@Pr_SA),(10*[ANN_PREM] ),(1.05*[CUM_LOAD_PREM])) AS value(v))
FormulaExtended:
  (SELECT MAX(v) FROM (VALUES (@Pr_SA),(10*((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000)) ),(1.05*((((ROUND((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE))))* (CASE WHEN PolicyYear  < @Pr_PPT THEN PolicyYear  else @Pr_PPT END))))) AS value(v))


FormulaKeyword: [MB_1]
FormulaWithFunction:
  (CASE WHEN PolicyYear=(@Pr_PT-6) and @PR_OPTION_1 =1 THEN 0.5 WHEN PolicyYear=(@Pr_PT-6) and @PR_OPTION_1 =2 THEN 0.2 ELSE 0 END)*@Pr_SA

FormulaBasic:
  (CASE WHEN PolicyYear=(@Pr_PT-6) and @PR_OPTION_1 =1 THEN 0.5 WHEN PolicyYear=(@Pr_PT-6) and @PR_OPTION_1 =2 THEN 0.2 ELSE 0 END)*@Pr_SA

FormulaExtended:
  (CASE WHEN PolicyYear=(@Pr_PT-6) and @PR_OPTION_1 =1 THEN 0.5 WHEN PolicyYear=(@Pr_PT-6) and @PR_OPTION_1 =2 THEN 0.2 ELSE 0 END)*@Pr_SA


FormulaKeyword: [MB_2]
FormulaWithFunction:
  (CASE WHEN PolicyYear=(@Pr_PT-3) and @PR_OPTION_1 =1 THEN 0.2 WHEN PolicyYear=(@Pr_PT-3) and @PR_OPTION_1 =2 THEN 0.3 ELSE 0 END)*@Pr_SA

FormulaBasic:
  (CASE WHEN PolicyYear=(@Pr_PT-3) and @PR_OPTION_1 =1 THEN 0.2 WHEN PolicyYear=(@Pr_PT-3) and @PR_OPTION_1 =2 THEN 0.3 ELSE 0 END)*@Pr_SA

FormulaExtended:
  (CASE WHEN PolicyYear=(@Pr_PT-3) and @PR_OPTION_1 =1 THEN 0.2 WHEN PolicyYear=(@Pr_PT-3) and @PR_OPTION_1 =2 THEN 0.3 ELSE 0 END)*@Pr_SA


FormulaKeyword: [MB_3]
FormulaWithFunction:
  (CASE WHEN PolicyYear=@Pr_PT and @PR_OPTION_1 =1 THEN 0.3 WHEN PolicyYear=@Pr_PT and @PR_OPTION_1 =2 THEN 0.5 ELSE 0 END)*@Pr_SA

FormulaBasic:
  (CASE WHEN PolicyYear=@Pr_PT and @PR_OPTION_1 =1 THEN 0.3 WHEN PolicyYear=@Pr_PT and @PR_OPTION_1 =2 THEN 0.5 ELSE 0 END)*@Pr_SA

FormulaExtended:
  (CASE WHEN PolicyYear=@Pr_PT and @PR_OPTION_1 =1 THEN 0.3 WHEN PolicyYear=@Pr_PT and @PR_OPTION_1 =2 THEN 0.5 ELSE 0 END)*@Pr_SA


FormulaKeyword: [MB_Total]
FormulaWithFunction: [MB_1]+[MB_2]+[MB_3]
FormulaBasic: [MB_1]+[MB_2]+[MB_3]
FormulaExtended:
  ((CASE WHEN PolicyYear=(@Pr_PT-6) and @PR_OPTION_1 =1 THEN 0.5 WHEN PolicyYear=(@Pr_PT-6) and @PR_OPTION_1 =2 THEN 0.2 ELSE 0 END)*@Pr_SA)+((CASE WHEN PolicyYear=(@Pr_PT-3) and @PR_OPTION_1 =1 THEN 0.2 WHEN PolicyYear=(@Pr_PT-3) and @PR_OPTION_1 =2 THEN 0.3 ELSE 0 END)*@Pr_SA)+((CASE WHEN PolicyYear=@Pr_PT and @PR_OPTION_1 =1 THEN 0.3 WHEN PolicyYear=@Pr_PT and @PR_OPTION_1 =2 THEN 0.5 ELSE 0 END)*@Pr_SA)


FormulaKeyword: [BB]
FormulaWithFunction: (CASE WHEN PolicyYear=@Pr_PT THEN [BB_RATE]*@Pr_SA ELSE 0 END)
FormulaBasic: (CASE WHEN PolicyYear=@Pr_PT THEN [BB_RATE]*@Pr_SA ELSE 0 END)
FormulaExtended:
  (CASE WHEN PolicyYear=@Pr_PT THEN ((SELECT RATE FROM BonusGuarantee WHERE ProductId=@Pr_Id AND PT=@Pr_PT AND OPTIONID=@PR_OPTION_1))*@Pr_SA ELSE 0 END)


FormulaKeyword: [MB_G]
FormulaWithFunction: [MB_3]+[BB]
FormulaBasic: [MB_3]+[BB]
FormulaExtended:
  ((CASE WHEN PolicyYear=@Pr_PT and @PR_OPTION_1 =1 THEN 0.3 WHEN PolicyYear=@Pr_PT and @PR_OPTION_1 =2 THEN 0.5 ELSE 0 END)*@Pr_SA)+((CASE WHEN PolicyYear=@Pr_PT THEN ((SELECT RATE FROM BonusGuarantee WHERE ProductId=@Pr_Id AND PT=@Pr_PT AND OPTIONID=@PR_OPTION_1))*@Pr_SA ELSE 0 END))


FormulaKeyword: [SB_G]
FormulaWithFunction: [MB_1]+[MB_2]+[MB_G]
FormulaBasic: [MB_1]+[MB_2]+[MB_G]
FormulaExtended:
  ((CASE WHEN PolicyYear=(@Pr_PT-6) and @PR_OPTION_1 =1 THEN 0.5 WHEN PolicyYear=(@Pr_PT-6) and @PR_OPTION_1 =2 THEN 0.2 ELSE 0 END)*@Pr_SA)+((CASE WHEN PolicyYear=(@Pr_PT-3) and @PR_OPTION_1 =1 THEN 0.2 WHEN PolicyYear=(@Pr_PT-3) and @PR_OPTION_1 =2 THEN 0.3 ELSE 0 END)*@Pr_SA)+(((CASE WHEN PolicyYear=@Pr_PT and @PR_OPTION_1 =1 THEN 0.3 WHEN PolicyYear=@Pr_PT and @PR_OPTION_1 =2 THEN 0.5 ELSE 0 END)*@Pr_SA)+((CASE WHEN PolicyYear=@Pr_PT THEN ((SELECT RATE FROM BonusGuarantee WHERE ProductId=@Pr_Id AND PT=@Pr_PT AND OPTIONID=@PR_OPTION_1))*@Pr_SA ELSE 0 END)))


FormulaKeyword: [PremiumRate]
FormulaWithFunction:
  ROUND((SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT AND PPT = @Pr_PPT),2)

FormulaBasic:
  ROUND((SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT AND PPT = @Pr_PPT),2)

FormulaExtended:
  ROUND((SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT AND PPT = @Pr_PPT),2)


FormulaKeyword: [MODAL_PREM]
FormulaWithFunction:
  (CASE WHEN PolicyYear<=1 THEN (CASE WHEN ((PolicyMonth-1)%(12/@mode_freq))=0 THEN @Pr_ModalPrem ELSE 0 END)  ELSE 0 END)

FormulaBasic:
  (CASE WHEN PolicyYear<=1 THEN (CASE WHEN ((PolicyMonth-1)%(12/@mode_freq))=0 THEN @Pr_ModalPrem ELSE 0 END)  ELSE 0 END)

FormulaExtended:
  (CASE WHEN PolicyYear<=1 THEN (CASE WHEN ((PolicyMonth-1)%(12/@mode_freq))=0 THEN @Pr_ModalPrem ELSE 0 END)  ELSE 0 END)


FormulaKeyword: [CUM_PREM]
FormulaWithFunction:
  (CASE WHEN PolicyYear<=1 THEN FLOOR((PolicyDuration-1)/(12/@MODE_FREQ))+1 ELSE @MODE_FREQ  END) * ([ANN_PREM]/@MODE_FREQ)

FormulaBasic:
  (CASE WHEN PolicyYear<=1 THEN FLOOR((PolicyDuration-1)/(12/@MODE_FREQ))+1 ELSE @MODE_FREQ  END) * ([ANN_PREM]/@MODE_FREQ)

FormulaExtended:
  (CASE WHEN PolicyYear<=1 THEN FLOOR((PolicyDuration-1)/(12/@MODE_FREQ))+1 ELSE @MODE_FREQ  END) * (((@Pr_MODALPREM))/@MODE_FREQ)


FormulaKeyword: [ALL_CHRG]
FormulaWithFunction:
  (CASE WHEN PolicyYear=1 THEN (CASE WHEN @Pr_Channel = 4 THEN 0.01 ELSE 0.03 END) ELSE 0 END)*[MODAL_PREM]

FormulaBasic:
  (CASE WHEN PolicyYear=1 THEN (CASE WHEN @Pr_Channel = 4 THEN 0.01 ELSE 0.03 END) ELSE 0 END)*[MODAL_PREM]

FormulaExtended:
  (CASE WHEN PolicyYear=1 THEN (CASE WHEN @Pr_Channel = 4 THEN 0.01 ELSE 0.03 END) ELSE 0 END)*((CASE WHEN PolicyYear<=1 THEN (CASE WHEN ((PolicyMonth-1)%(12/@mode_freq))=0 THEN @Pr_ModalPrem ELSE 0 END)  ELSE 0 END))


FormulaKeyword: [MORT_RATE]
FormulaWithFunction:
  (ROUND((1+[EMR_RATE])*(SELECT Round(Rate,2) FROM MortalityCharge WHERE GENDER=@LI_Gender AND ProductID=@Pr_id AND LaAge=@LI_Entry_Age+PolicyYear-1),2) + (CASE WHEN @NSAP_FLAG = 0 THEN 1.5 ELSE 0 END) + [FlatExtra_RATE]) /12000

FormulaBasic:
  (ROUND((1+[EMR_RATE])*(SELECT Round(Rate,2) FROM MortalityCharge WHERE GENDER=@LI_Gender AND ProductID=@Pr_id AND LaAge=@LI_Entry_Age+PolicyYear-1),2) + (CASE WHEN @NSAP_FLAG = 0 THEN 1.5 ELSE 0 END) + [FlatExtra_RATE]) /12000

FormulaExtended:
  (ROUND((1+((@Pr_EMRId)))*(SELECT Round(Rate,2) FROM MortalityCharge WHERE GENDER=@LI_Gender AND ProductID=@Pr_id AND LaAge=@LI_Entry_Age+PolicyYear-1),2) + (CASE WHEN @NSAP_FLAG = 0 THEN 1.5 ELSE 0 END) + ((@Pr_FlatExtraId))) /12000


FormulaKeyword: [INV_RATE]
FormulaWithFunction: POWER((1.000000000000+@int_rate),(1.000000000000/12.000000000000))-1
FormulaBasic:
  (SELECT POWER(CONVERT(DECIMAL(16,14), (1.000000000000+@int_rate)), CONVERT(DECIMAL(16,14),(1.000000000000/12.000000000000))))-1

FormulaExtended:
  (SELECT POWER(CONVERT(DECIMAL(16,14), (1.000000000000+@int_rate)), CONVERT(DECIMAL(16,14),(1.000000000000/12.000000000000))))-1


FormulaKeyword: [ST_RATE]
FormulaWithFunction: [TAX_1]
FormulaBasic: [TAX_1]
FormulaExtended:
  ((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))


FormulaKeyword: [SV_RATE]
FormulaWithFunction:
  (SELECT Charge FROM ULIPSV WHERE PRODUCTID = @Pr_ID and (CASE WHEN PolicyMonth = 12 THEN PolicyYear+1 ELSE PolicyYear End) BETWEEN FromPolicyYear and ToPolicyYear)

FormulaBasic:
  (SELECT Charge FROM ULIPSV WHERE PRODUCTID = @Pr_ID and (CASE WHEN PolicyMonth = 12 THEN PolicyYear+1 ELSE PolicyYear End) BETWEEN FromPolicyYear and ToPolicyYear)

FormulaExtended:
  (SELECT Charge FROM ULIPSV WHERE PRODUCTID = @Pr_ID and (CASE WHEN PolicyMonth = 12 THEN PolicyYear+1 ELSE PolicyYear End) BETWEEN FromPolicyYear and ToPolicyYear)


FormulaKeyword: [SV_MAX]
FormulaWithFunction:
  (SELECT CapAmount FROM ULIPSV WHERE PRODUCTID = @Pr_ID and (CASE WHEN PolicyMonth = 12 THEN PolicyYear+1 ELSE PolicyYear End) BETWEEN FromPolicyYear and ToPolicyYear)

FormulaBasic:
  (SELECT CapAmount FROM ULIPSV WHERE PRODUCTID = @Pr_ID and (CASE WHEN PolicyMonth = 12 THEN PolicyYear+1 ELSE PolicyYear End) BETWEEN FromPolicyYear and ToPolicyYear)

FormulaExtended:
  (SELECT CapAmount FROM ULIPSV WHERE PRODUCTID = @Pr_ID and (CASE WHEN PolicyMonth = 12 THEN PolicyYear+1 ELSE PolicyYear End) BETWEEN FromPolicyYear and ToPolicyYear)


FormulaKeyword: [Commission]
FormulaWithFunction:
  (CASE WHEN @PR_Channel = 4 THEN 0 ELSE (SELECT Rate FROM ProductCommission WHERE PRODUCTID = @Pr_ID and PolicyYear BETWEEN FromPolicyYear and ToPolicyYear)*[MODAL_PREM] END)

FormulaBasic:
  (CASE WHEN @PR_Channel = 4 THEN 0 ELSE (SELECT Rate FROM ProductCommission WHERE PRODUCTID = @Pr_ID and PolicyYear BETWEEN FromPolicyYear and ToPolicyYear)*[MODAL_PREM] END)

FormulaExtended:
  (CASE WHEN @PR_Channel = 4 THEN 0 ELSE (SELECT Rate FROM ProductCommission WHERE PRODUCTID = @Pr_ID and PolicyYear BETWEEN FromPolicyYear and ToPolicyYear)*((CASE WHEN PolicyYear<=1 THEN (CASE WHEN ((PolicyMonth-1)%(12/@mode_freq))=0 THEN @Pr_ModalPrem ELSE 0 END)  ELSE 0 END)) END)


FormulaKeyword: [NSAP_VAL]
FormulaWithFunction: ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * @Pr_SA /1000 ELSE 0 END) * [MODE_DISC],2,1)
FormulaBasic: ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * @Pr_SA /1000 ELSE 0 END) * [MODE_DISC],2,1)
FormulaExtended:
  ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * @Pr_SA /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1)


FormulaKeyword: [MODAL_PREM]
FormulaWithFunction: ROUND(([MODAL_PREM_WNSAP] + [NSAP_VAL]),0)
FormulaBasic: ROUND(([MODAL_PREM_WNSAP] + [NSAP_VAL]),0)
FormulaExtended:
  ROUND(((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * @Pr_SA /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)


FormulaKeyword: [TAX_MP]
FormulaWithFunction: ROUND(([MODAL_PREM] * [TAX_1]),0)
FormulaBasic: ROUND(([MODAL_PREM] * [TAX_1]),0)
FormulaExtended:
  ROUND(((ROUND(((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * @Pr_SA /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)) * ((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))),0)


FormulaKeyword: [MODAL_PREM_TAX]
FormulaWithFunction: ([MODAL_PREM]) + [TAX_MP]
FormulaBasic: ([MODAL_PREM]) + [TAX_MP]
FormulaExtended:
  ((ROUND(((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * @Pr_SA /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0))) + (ROUND(((ROUND(((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * @Pr_SA /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)) * ((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))),0))


FormulaKeyword: [LOAD_ANN_PREM_NSAP]
FormulaWithFunction: ([MODAL_PREM])*([MODE_FREQ])
FormulaBasic: ([MODAL_PREM])*([MODE_FREQ])
FormulaExtended:
  ((ROUND(((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * @Pr_SA /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))


FormulaKeyword: [ANN_PREM_YEARLY_NSAP]
FormulaWithFunction: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Pr_PPT THEN [LOAD_ANN_PREM_NSAP] ELSE 0 END)
FormulaBasic: (CASE WHEN PolicyYear > 0 AND PolicyYear <=@Pr_PPT THEN [LOAD_ANN_PREM_NSAP] ELSE 0 END)
FormulaExtended:
  (CASE  WHEN PolicyYear  > 0 AND PolicyYear  <=@Pr_PPT THEN (((ROUND(((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)) + (ROUND((CASE WHEN @NSAP_FLAG = 0 THEN 1.5 * @Pr_SA /1000 ELSE 0 END) * ((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id)),2,1))),0)))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))) ELSE 0 END)


FormulaKeyword: [GUAR_ADD]
FormulaWithFunction: (CASE WHEN @Pr_PT = 10 THEN 0.04 WHEN @Pr_PT = 15 THEN 0.05 ELSE 0.06 END) * [LOAD_ANN_PREM]
FormulaBasic: (CASE WHEN @Pr_PT = 10 THEN 0.04 WHEN @Pr_PT = 15 THEN 0.05 ELSE 0.06 END) * [LOAD_ANN_PREM]
FormulaExtended:
  (CASE WHEN @Pr_PT = 10 THEN 0.04 WHEN @Pr_PT = 15 THEN 0.05 ELSE 0.06 END) * ((ROUND((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE))))


FormulaKeyword: [ACCR_GUAR_ADD]
FormulaWithFunction: [GUAR_ADD] * PolicyYear
FormulaBasic: [GUAR_ADD] * PolicyYear
FormulaExtended:
  ((CASE WHEN @Pr_PT = 10 THEN 0.04 WHEN @Pr_PT = 15 THEN 0.05 ELSE 0.06 END) * ((ROUND((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE))))) * PolicyYear


FormulaKeyword: [DB_G]
FormulaWithFunction: (@Pr_SA + [ACCR_GUAR_ADD])
FormulaBasic: (@Pr_SA + [ACCR_GUAR_ADD])
FormulaExtended:
  (@Pr_SA + (((CASE WHEN @Pr_PT = 10 THEN 0.04 WHEN @Pr_PT = 15 THEN 0.05 ELSE 0.06 END) * ((ROUND((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE))))) * PolicyYear))


FormulaKeyword: [MBACK]
FormulaWithFunction: (CASE WHEN ((PolicyYear % 5 = 0) AND (PolicyYear < @Pr_PT)) THEN 2*[LOAD_ANN_PREM] ELSE 0 END)
FormulaBasic: (CASE WHEN ((PolicyYear % 5 = 0) AND (PolicyYear < @Pr_PT)) THEN 2*[LOAD_ANN_PREM] ELSE 0 END)
FormulaExtended:
  (CASE WHEN ((PolicyYear % 5 = 0)  AND (PolicyYear < @Pr_PT)) THEN 2*((ROUND((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))) ELSE 0 END)


FormulaKeyword: [MB_G]
FormulaWithFunction:
  (CASE WHEN PolicyYear  = (@Pr_PT) THEN @Pr_SA + ([ACCR_GUAR_ADD]) -  (((PolicyYear/5)-1)*2*[LOAD_ANN_PREM]) ELSE 0 END)

FormulaBasic:
  (CASE WHEN PolicyYear  = (@Pr_PT) THEN @Pr_SA + ([ACCR_GUAR_ADD]) -  (((PolicyYear/5)-1)*2*[LOAD_ANN_PREM]) ELSE 0 END)

FormulaExtended:
  (CASE WHEN PolicyYear  = (@Pr_PT) THEN @Pr_SA + ((((CASE WHEN @Pr_PT = 10 THEN 0.04 WHEN @Pr_PT = 15 THEN 0.05 ELSE 0.06 END) * ((ROUND((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE))))) * PolicyYear)) -  (((PolicyYear/5)-1)*2*((ROUND((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE))))) ELSE 0 END)


FormulaKeyword: [SB_G]
FormulaWithFunction: [MBACK]+[MB_G]
FormulaBasic: [MBACK]+[MB_G]
FormulaExtended:
  ((CASE WHEN ((PolicyYear % 5 = 0)  AND (PolicyYear < @Pr_PT)) THEN 2*((ROUND((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE)))) ELSE 0 END))+((CASE WHEN PolicyYear  = (@Pr_PT) THEN @Pr_SA + ((((CASE WHEN @Pr_PT = 10 THEN 0.04 WHEN @Pr_PT = 15 THEN 0.05 ELSE 0.06 END) * ((ROUND((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE))))) * PolicyYear)) -  (((PolicyYear/5)-1)*2*((ROUND((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE))))) ELSE 0 END))


FormulaKeyword: [Guar_ADD_SV]
FormulaWithFunction:
  (CASE WHEN PolicyYear >= 3 THEN  ((SELECT RATE FROM SV where ProductId = @Pr_Id AND PolicyYear = FromYear  AND PT = @Pr_PT AND AGE = @LI_Entry_Age) * [ACCR_GUAR_ADD]) ELSE 0 END)

FormulaBasic:
  (CASE WHEN PolicyYear >= 3 THEN  ((SELECT RATE FROM SV where ProductId = @Pr_Id AND PolicyYear = FromYear  AND PT = @Pr_PT AND AGE = @LI_Entry_Age) * [ACCR_GUAR_ADD]) ELSE 0 END)

FormulaExtended:
  (CASE WHEN PolicyYear >= 3 THEN  ((SELECT RATE FROM SV where ProductId = @Pr_Id AND PolicyYear = FromYear  AND PT = @Pr_PT AND AGE = @LI_Entry_Age) * (((CASE WHEN @Pr_PT = 10 THEN 0.04 WHEN @Pr_PT = 15 THEN 0.05 ELSE 0.06 END) * ((ROUND((ROUND((((((@PREM_RATE - ((SELECT DiscountRate From LSADMaster where ProductId = @Pr_Id and @Pr_SA between FromSa and ToSA))) * (@Pr_SA))/1000))*((SELECT Multiplier FROM ProductMode WHERE ModeId=@INPUT_MODE AND ProductId=@Pr_Id))),2,1)),0))*(((SELECT Frequency from ModeMaster where ModeId = @INPUT_MODE))))) * PolicyYear)) ELSE 0 END)


FormulaKeyword: [PremiumRate]
FormulaWithFunction:
  (SELECT Round(RATE,2) FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT)

FormulaBasic:
  (SELECT Round(RATE,2) FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT)

FormulaExtended:
  (SELECT Round(RATE,2) FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT)


FormulaKeyword: [Primary_Borrower_Share]
FormulaWithFunction:
  (CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*[LOAN_AMT])/100 ELSE  [LOAN_AMT] END)

FormulaBasic:
  (CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*[LOAN_AMT])/100 ELSE  [LOAN_AMT] END)

FormulaExtended:
  (CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)


FormulaKeyword: [Secondary_Borrower_Share]
FormulaWithFunction:
  (CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*[LOAN_AMT])/100 ELSE  [LOAN_AMT] END) ELSE 0 END)

FormulaBasic:
  (CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*[LOAN_AMT])/100 ELSE  [LOAN_AMT] END) ELSE 0 END)

FormulaExtended:
  (CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)


FormulaKeyword: [Secondary_Borr_Share_Disp]
FormulaWithFunction: (CASE WHEN @Pr_Option_7 = 27 THEN Convert(Varchar(20),[Secondary_Borrower_Share]) ELSE 'NA' END)
FormulaBasic: (CASE WHEN @Pr_Option_7 = 27 THEN Convert(Varchar(20),[Secondary_Borrower_Share]) ELSE 'NA' END)
FormulaExtended:
  (CASE WHEN @Pr_Option_7 = 27 THEN Convert(Varchar(20),((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))) ELSE 'NA' END)


FormulaKeyword: [Secondary_Borrower_Rate]
FormulaWithFunction:
  Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)

FormulaBasic:
  Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)

FormulaExtended:
  Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)


FormulaKeyword: [Secondary_RATE_TAX]
FormulaWithFunction: ([Secondary_Borrower_Rate]*(1+[TAX_1]))/1000
FormulaBasic: ([Secondary_Borrower_Rate]*(1+[TAX_1]))/1000
FormulaExtended:
  ((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000


FormulaKeyword: [Primary_Prem_Fund]
FormulaWithFunction:
  (CASE WHEN @Pr_OPTION_6=24 THEN ([Primary_Borrower_Share])*((1/(1-[Primary_RATE_TAX]))-1) ELSE 0 END)

FormulaBasic:
  (CASE WHEN @Pr_OPTION_6=24 THEN ([Primary_Borrower_Share])*((1/(1-[Primary_RATE_TAX]))-1) ELSE 0 END)

FormulaExtended:
  (CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)


FormulaKeyword: [Secondary_Prem_Fund]
FormulaWithFunction:
  (CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN ([Secondary_Borrower_Share])*((1/(1-[Secondary_RATE_TAX]))-1)  ELSE 0 END)

FormulaBasic:
  (CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN ([Secondary_Borrower_Share])*((1/(1-[Secondary_RATE_TAX]))-1)  ELSE 0 END)

FormulaExtended:
  (CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)


FormulaKeyword: [SA_Primary]
FormulaWithFunction:
  min(CEILING((([Primary_Borrower_Share] + [Primary_Prem_Fund] + (CASE WHEN @Pr_Option_8=28 THEN [Secondary_Prem_Fund]  ELSE 0 END))/1000))*1000,1000000000)

FormulaBasic:
  (SELECT MIN(v) FROM (VALUES (CEILING((([Primary_Borrower_Share] + [Primary_Prem_Fund] + (CASE WHEN @Pr_Option_8=28 THEN [Secondary_Prem_Fund]  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))

FormulaExtended:
  (SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))


FormulaKeyword: [SA_Secondary]
FormulaWithFunction:
  min(CEILING((([Secondary_Borrower_Share] + [Secondary_Prem_Fund] + (CASE WHEN @Pr_Option_8=28 THEN [Primary_Prem_Fund]  ELSE 0 END))/1000))*1000,1000000000)

FormulaBasic:
  (SELECT MIN(v) FROM (VALUES (CEILING((([Secondary_Borrower_Share] + [Secondary_Prem_Fund] + (CASE WHEN @Pr_Option_8=28 THEN [Primary_Prem_Fund]  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))

FormulaExtended:
  (SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))


FormulaKeyword: [HSAD_Primary]
FormulaWithFunction:
  ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and [SA_Primary] between FromSa AND ToSa)*(@Prem_Rate)*[SA_Primary])/1000,2)

FormulaBasic:
  ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and [SA_Primary] between FromSa AND ToSa)*(@Prem_Rate)*[SA_Primary])/1000,2)

FormulaExtended:
  ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))) between FromSa AND ToSa)*(@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,2)


FormulaKeyword: [HSAD_Secondary]
FormulaWithFunction:
  ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and [SA_Secondary] between FromSa AND ToSa)*([Secondary_Borrower_Rate])*([SA_Secondary]))/1000,2)

FormulaBasic:
  ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and [SA_Secondary] between FromSa AND ToSa)*([Secondary_Borrower_Rate])*([SA_Secondary]))/1000,2)

FormulaExtended:
  ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))) between FromSa AND ToSa)*((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))))/1000,2)


FormulaKeyword: [JL_Primary]
FormulaWithFunction: ROUND((([JL_Rebate])*(@Prem_Rate)*[SA_Primary])/1000,2)
FormulaBasic: ROUND((([JL_Rebate])*(@Prem_Rate)*[SA_Primary])/1000,2)
FormulaExtended:
  ROUND(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 28 THEN ( 0.025) ELSE 0 END)))*(@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,2)


FormulaKeyword: [JL_Secondary]
FormulaWithFunction: ROUND((([JL_Rebate])*([Secondary_Borrower_Rate])*([SA_Secondary]))/1000,2)
FormulaBasic: ROUND((([JL_Rebate])*([Secondary_Borrower_Rate])*([SA_Secondary]))/1000,2)
FormulaExtended:
  ROUND(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 28 THEN ( 0.025) ELSE 0 END)))*((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))))/1000,2)


FormulaKeyword: [ANN_PREM_Primary]
FormulaWithFunction: round((round(((@Prem_Rate)*[SA_Primary])/1000,0) - [HSAD_Primary] - [JL_Primary]),0)
FormulaBasic: round((round(((@Prem_Rate)*[SA_Primary])/1000,0) - [HSAD_Primary] - [JL_Primary]),0)
FormulaExtended:
  round((round(((@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,0) - (ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))) between FromSa AND ToSa)*(@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,2)) - (ROUND(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 28 THEN ( 0.025) ELSE 0 END)))*(@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,2))),0)


FormulaKeyword: [ANN_PREM_Secondary]
FormulaWithFunction:
  Round((round((([Secondary_Borrower_Rate])*[SA_Secondary])/1000,0)-[HSAD_Secondary]-[JL_Secondary]),0)

FormulaBasic:
  Round((round((([Secondary_Borrower_Rate])*[SA_Secondary])/1000,0)-[HSAD_Secondary]-[JL_Secondary]),0)

FormulaExtended:
  Round((round((((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,0)-(ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))) between FromSa AND ToSa)*((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))))/1000,2))-(ROUND(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 28 THEN ( 0.025) ELSE 0 END)))*((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))))/1000,2))),0)


FormulaKeyword: [ANN_PREM]
FormulaWithFunction: ([ANN_PREM_Primary] + [ANN_PREM_Secondary])
FormulaBasic: ([ANN_PREM_Primary] + [ANN_PREM_Secondary])
FormulaExtended:
  ((round((round(((@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,0) - (ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))) between FromSa AND ToSa)*(@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,2)) - (ROUND(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 28 THEN ( 0.025) ELSE 0 END)))*(@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,2))),0)) + (Round((round((((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,0)-(ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))) between FromSa AND ToSa)*((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))))/1000,2))-(ROUND(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 28 THEN ( 0.025) ELSE 0 END)))*((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))))/1000,2))),0)))


FormulaKeyword: [MODAL_PREM]
FormulaWithFunction: [ANN_PREM]
FormulaBasic: [ANN_PREM]
FormulaExtended:
  (((round((round(((@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,0) - (ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))) between FromSa AND ToSa)*(@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,2)) - (ROUND(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 28 THEN ( 0.025) ELSE 0 END)))*(@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,2))),0)) + (Round((round((((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,0)-(ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))) between FromSa AND ToSa)*((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))))/1000,2))-(ROUND(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 28 THEN ( 0.025) ELSE 0 END)))*((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))))/1000,2))),0))))


FormulaKeyword: [MODAL_PREM_TAX]
FormulaWithFunction: ([MODAL_PREM]) + [TAX_MP]
FormulaBasic: ([MODAL_PREM]) + [TAX_MP]
FormulaExtended:
  (((((round((round(((@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,0) - (ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))) between FromSa AND ToSa)*(@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,2)) - (ROUND(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 28 THEN ( 0.025) ELSE 0 END)))*(@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,2))),0)) + (Round((round((((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,0)-(ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))) between FromSa AND ToSa)*((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))))/1000,2))-(ROUND(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 28 THEN ( 0.025) ELSE 0 END)))*((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))))/1000,2))),0)))))) + (ROUND((((((round((round(((@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,0) - (ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))) between FromSa AND ToSa)*(@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,2)) - (ROUND(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 28 THEN ( 0.025) ELSE 0 END)))*(@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,2))),0)) + (Round((round((((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,0)-(ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))) between FromSa AND ToSa)*((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))))/1000,2))-(ROUND(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 28 THEN ( 0.025) ELSE 0 END)))*((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))))/1000,2))),0))))) * ((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))),2))


FormulaKeyword: [SA]
FormulaWithFunction:
  (CASE WHEN @Pr_Option_7 =  27 AND @Pr_Option_8= 29 THEN Min([SA_Primary],[SA_Secondary]) ELSE [SA_Primary] END)

FormulaBasic:
  (CASE WHEN @Pr_Option_7 =  27 AND @Pr_Option_8= 29 THEN (SELECT MIN(v) FROM (VALUES ([SA_Primary]),([SA_Secondary])) AS value(v)) ELSE [SA_Primary] END)

FormulaExtended:
  (CASE WHEN @Pr_Option_7 =  27 AND @Pr_Option_8= 29 THEN (SELECT MIN(v) FROM (VALUES (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))),(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))) AS value(v)) ELSE ((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))) END)


FormulaKeyword: [ANN_PREM_YEARLY]
FormulaWithFunction: (CASE WHEN PolicyYear <= 1 THEN [ANN_PREM] ELSE 0 END)
FormulaBasic: (CASE WHEN PolicyYear <= 1 THEN [ANN_PREM] ELSE 0 END)
FormulaExtended:
  (CASE WHEN PolicyYear <= 1 THEN (((round((round(((@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,0) - (ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))) between FromSa AND ToSa)*(@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,2)) - (ROUND(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 28 THEN ( 0.025) ELSE 0 END)))*(@Prem_Rate)*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,2))),0)) + (Round((round((((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))/1000,0)-(ROUND(((SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and ((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))) between FromSa AND ToSa)*((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))))/1000,2))-(ROUND(((((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 28 THEN ( 0.025) ELSE 0 END)))*((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_6 = 24 AND @Pr_Option_7 = 27  THEN (((CASE WHEN @Pr_Option_7 = 27 THEN (CASE WHEN @Pr_Option_8 = 29 THEN ((100-@Option_Value_8)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)))*((1/(1-(((Round((CASE WHEN @Pr_Option_7 = 27  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @Option_Value_7 AND PT = @Pr_PT and Optionid =  (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END)  and SAUpper = @Pr_Option_3 and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN @Pr_OPTION_2 = 2  and @Pr_OPTION_4>17 THEN @Pr_Option_5 ELSE 23 END) )  ELSE 0 END),2))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1)  ELSE 0 END)) + (CASE WHEN @Pr_Option_8=28 THEN ((CASE WHEN @Pr_OPTION_6=24 THEN (((CASE WHEN @Pr_Option_7 = 27 AND @Pr_Option_8 = 29 THEN (@Option_Value_8*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)))*((1/(1-((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)))-1) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))))/1000,2))),0)))) ELSE 0 END)


FormulaKeyword: [PremiumRate]
FormulaWithFunction:
  ROUND((SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT and Optionid = (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END) and SAUpper = @Pr_Option_3  and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN (@Pr_OPTION_2 = 2 and @Pr_OPTION_4>17) THEN @Pr_Option_5 ELSE 23 END) ),2)

FormulaBasic:
  ROUND((SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT and Optionid = (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END) and SAUpper = @Pr_Option_3  and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN (@Pr_OPTION_2 = 2 and @Pr_OPTION_4>17) THEN @Pr_Option_5 ELSE 23 END) ),2)

FormulaExtended:
  ROUND((SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT and Optionid = (CASE WHEN @Pr_Option_2 =2 THEN 3 ELSE @Pr_Option_2 END) and SAUpper = @Pr_Option_3  and SMOKING = (CASE WHEN @Pr_OPTION_2 = 2 THEN @Pr_Option_4 ELSE 17 END) AND Field1 = (CASE WHEN (@Pr_OPTION_2 = 2 and @Pr_OPTION_4>17) THEN @Pr_Option_5 ELSE 23 END) ),2)


FormulaKeyword: [MODAL_PREM]
FormulaWithFunction:
  (CASE WHEN PolicyYear<=@Pr_PPT THEN (CASE WHEN ((PolicyMonth-1)%(12/@Mode_Freq))=0 THEN [ANN_PREM]/(@MODE_FREQ) ELSE 0 END) ELSE 0 END)

FormulaBasic:
  (CASE WHEN PolicyYear<=@Pr_PPT THEN (CASE WHEN ((PolicyMonth-1)%(12/@Mode_Freq))=0 THEN [ANN_PREM]/(@MODE_FREQ) ELSE 0 END) ELSE 0 END)

FormulaExtended:
  (CASE WHEN PolicyYear<=@Pr_PPT THEN (CASE WHEN ((PolicyMonth-1)%(12/@Mode_Freq))=0 THEN ((@Pr_ANNPREM))/(@MODE_FREQ) ELSE 0 END) ELSE 0 END)


FormulaKeyword: [LOAD_ANN_PREM]
FormulaWithFunction: [MODAL_PREM]* (@Mode_Freq)
FormulaBasic: [MODAL_PREM]* (@Mode_Freq)
FormulaExtended:
  ((CASE WHEN PolicyYear<=@Pr_PPT THEN (CASE WHEN ((PolicyMonth-1)%(12/@Mode_Freq))=0 THEN ((@Pr_ANNPREM))/(@MODE_FREQ) ELSE 0 END) ELSE 0 END))* (@Mode_Freq)


FormulaKeyword: [ANN_PREM_YEARLY_NSAP]
FormulaWithFunction: [LOAD_ANN_PREM]
FormulaBasic: [LOAD_ANN_PREM]
FormulaExtended:
  (((CASE WHEN PolicyYear<=@Pr_PPT THEN (CASE WHEN ((PolicyMonth-1)%(12/@Mode_Freq))=0 THEN ((@Pr_ANNPREM))/(@MODE_FREQ) ELSE 0 END) ELSE 0 END))* (@Mode_Freq))


FormulaKeyword: [CUM_PREM]
FormulaWithFunction:
  (CASE WHEN PolicyYear<=@Pr_PPT THEN FLOOR((PolicyDuration-1)/(12/@MODE_FREQ))+1 ELSE @MODE_FREQ * @Pr_PPT END) * ([ANN_PREM]/@MODE_FREQ)

FormulaBasic:
  (CASE WHEN PolicyYear<=@Pr_PPT THEN FLOOR((PolicyDuration-1)/(12/@MODE_FREQ))+1 ELSE @MODE_FREQ * @Pr_PPT END) * ([ANN_PREM]/@MODE_FREQ)

FormulaExtended:
  (CASE WHEN PolicyYear<=@Pr_PPT THEN FLOOR((PolicyDuration-1)/(12/@MODE_FREQ))+1 ELSE @MODE_FREQ * @Pr_PPT END) * (((@Pr_ANNPREM))/@MODE_FREQ)


FormulaKeyword: [ALL_CHRG]
FormulaWithFunction:
  (CASE WHEN @Pr_Channel = 4 and PolicyYear = 1 THEN 0 ELSE (SELECT CHARGE FROM AllocCharge WHERE (PolicyYear BETWEEN FromPolicyYear and ToPolicyYear) AND ProductId=@Pr_ID)*[MODAL_PREM] END)

FormulaBasic:
  (CASE WHEN @Pr_Channel = 4 and PolicyYear = 1 THEN 0 ELSE (SELECT CHARGE FROM AllocCharge WHERE (PolicyYear BETWEEN FromPolicyYear and ToPolicyYear) AND ProductId=@Pr_ID)*[MODAL_PREM] END)

FormulaExtended:
  (CASE WHEN @Pr_Channel = 4 and PolicyYear = 1 THEN 0 ELSE (SELECT CHARGE FROM AllocCharge WHERE (PolicyYear BETWEEN FromPolicyYear and ToPolicyYear) AND ProductId=@Pr_ID)*((CASE WHEN PolicyYear<=@Pr_PPT THEN (CASE WHEN ((PolicyMonth-1)%(12/@Mode_Freq))=0 THEN ((@Pr_ANNPREM))/(@MODE_FREQ) ELSE 0 END) ELSE 0 END)) END)


FormulaKeyword: [ADMIN_CHRG_1]
FormulaWithFunction: (CASE WHEN PolicyYear<=10 THEN 0.02500000/12.00000000 ELSE 0.02250000/12.00000000 END)*[ANN_PREM]
FormulaBasic: (CASE WHEN PolicyYear<=10 THEN 0.02500000/12.00000000 ELSE 0.02250000/12.00000000 END)*[ANN_PREM]
FormulaExtended:
  (CASE WHEN PolicyYear<=10 THEN 0.02500000/12.00000000 ELSE 0.02250000/12.00000000 END)*((@Pr_ANNPREM))


FormulaKeyword: [ADMIN_CHRG]
FormulaWithFunction: CASE WHEN [ADMIN_CHRG_1]<500 THEN [ADMIN_CHRG_1] ELSE 500 END
FormulaBasic: CASE WHEN [ADMIN_CHRG_1]<500 THEN [ADMIN_CHRG_1] ELSE 500 END
FormulaExtended:
  CASE WHEN ((CASE WHEN PolicyYear<=10 THEN 0.02500000/12.00000000 ELSE 0.02250000/12.00000000 END)*((@Pr_ANNPREM)))<500 THEN ((CASE WHEN PolicyYear<=10 THEN 0.02500000/12.00000000 ELSE 0.02250000/12.00000000 END)*((@Pr_ANNPREM))) ELSE 500 END


FormulaKeyword: [MORT_RATE]
FormulaWithFunction:
  (ROUND((1+[EMR_RATE])*(SELECT Rate FROM MortalityCharge WHERE GENDER=@LI_Gender AND ProductID=@Pr_id AND LaAge=@LI_Entry_Age+PolicyYear-1),2) + (CASE WHEN @NSAP_FLAG = 0 THEN 1.5 ELSE 0 END) + [FlatExtra_RATE]) /12000.000000

FormulaBasic:
  (ROUND((1+[EMR_RATE])*(SELECT Rate FROM MortalityCharge WHERE GENDER=@LI_Gender AND ProductID=@Pr_id AND LaAge=@LI_Entry_Age+PolicyYear-1),2) + (CASE WHEN @NSAP_FLAG = 0 THEN 1.5 ELSE 0 END) + [FlatExtra_RATE]) /12000.000000

FormulaExtended:
  (ROUND((1+((@Pr_EMRId)))*(SELECT Rate FROM MortalityCharge WHERE GENDER=@LI_Gender AND ProductID=@Pr_id AND LaAge=@LI_Entry_Age+PolicyYear-1),2) + (CASE WHEN @NSAP_FLAG = 0 THEN 1.5 ELSE 0 END) + ((@Pr_FlatExtraId))) /12000.000000


FormulaKeyword: [INV_RATE]
FormulaWithFunction: POWER((1.000000000000+@int_rate),(1.000000000000/12.000000000000))-1
FormulaBasic:
  (SELECT POWER(CONVERT(DECIMAL(16,12), (1.000000000000+@int_rate)), CONVERT(DECIMAL(16,12),(1.000000000000/12.000000000000))))-1

FormulaExtended:
  (SELECT POWER(CONVERT(DECIMAL(16,12), (1.000000000000+@int_rate)), CONVERT(DECIMAL(16,12),(1.000000000000/12.000000000000))))-1


FormulaKeyword: [SV_RATE]
FormulaWithFunction:
  (SELECT Charge FROM ULIPSV WHERE PRODUCTID = @Pr_ID and ([ANN_PREM] BETWEEN MinPremium and MaxPremium) and (CASE WHEN PolicyMonth = 12 THEN PolicyYear+1 ELSE PolicyYear End) BETWEEN FromPolicyYear and ToPolicyYear)

FormulaBasic:
  (SELECT Charge FROM ULIPSV WHERE PRODUCTID = @Pr_ID and ([ANN_PREM] BETWEEN MinPremium and MaxPremium) and (CASE WHEN PolicyMonth = 12 THEN PolicyYear+1 ELSE PolicyYear End) BETWEEN FromPolicyYear and ToPolicyYear)

FormulaExtended:
  (SELECT Charge FROM ULIPSV WHERE PRODUCTID = @Pr_ID and (((@Pr_ANNPREM)) BETWEEN MinPremium and MaxPremium) and (CASE WHEN PolicyMonth = 12 THEN PolicyYear+1 ELSE PolicyYear End) BETWEEN FromPolicyYear and ToPolicyYear)


FormulaKeyword: [SV_MAX]
FormulaWithFunction:
  (SELECT CapAmount FROM ULIPSV WHERE PRODUCTID = @Pr_ID and ([ANN_PREM] BETWEEN MinPremium and MaxPremium) and (CASE WHEN PolicyMonth = 12 THEN PolicyYear+1 ELSE PolicyYear End) BETWEEN FromPolicyYear and ToPolicyYear)

FormulaBasic:
  (SELECT CapAmount FROM ULIPSV WHERE PRODUCTID = @Pr_ID and ([ANN_PREM] BETWEEN MinPremium and MaxPremium) and (CASE WHEN PolicyMonth = 12 THEN PolicyYear+1 ELSE PolicyYear End) BETWEEN FromPolicyYear and ToPolicyYear)

FormulaExtended:
  (SELECT CapAmount FROM ULIPSV WHERE PRODUCTID = @Pr_ID and (((@Pr_ANNPREM)) BETWEEN MinPremium and MaxPremium) and (CASE WHEN PolicyMonth = 12 THEN PolicyYear+1 ELSE PolicyYear End) BETWEEN FromPolicyYear and ToPolicyYear)


FormulaKeyword: [Commission]
FormulaWithFunction:
  (CASE WHEN @Pr_Channel = 4 THEN 0 ELSE (SELECT Rate FROM ProductCommission WHERE PRODUCTID = @Pr_ID and ([ANN_PREM] BETWEEN MinPremium and MaxPremium) and PolicyYear BETWEEN FromPolicyYear and ToPolicyYear)*[MODAL_PREM] END)

FormulaBasic:
  (CASE WHEN @Pr_Channel = 4 THEN 0 ELSE (SELECT Rate FROM ProductCommission WHERE PRODUCTID = @Pr_ID and ([ANN_PREM] BETWEEN MinPremium and MaxPremium) and PolicyYear BETWEEN FromPolicyYear and ToPolicyYear)*[MODAL_PREM] END)

FormulaExtended:
  (CASE WHEN @Pr_Channel = 4 THEN 0 ELSE (SELECT Rate FROM ProductCommission WHERE PRODUCTID = @Pr_ID and (((@Pr_ANNPREM)) BETWEEN MinPremium and MaxPremium) and PolicyYear BETWEEN FromPolicyYear and ToPolicyYear)*((CASE WHEN PolicyYear<=@Pr_PPT THEN (CASE WHEN ((PolicyMonth-1)%(12/@Mode_Freq))=0 THEN ((@Pr_ANNPREM))/(@MODE_FREQ) ELSE 0 END) ELSE 0 END)) END)


FormulaKeyword: [Primary_Borrower_Share]
FormulaWithFunction:
  (CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*[LOAN_AMT])/100 ELSE  [LOAN_AMT] END)

FormulaBasic:
  (CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*[LOAN_AMT])/100 ELSE  [LOAN_AMT] END)

FormulaExtended:
  (CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)


FormulaKeyword: [Secondary_Borrower_Share]
FormulaWithFunction:
  (CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*[LOAN_AMT])/100 ELSE  [LOAN_AMT] END) ELSE 0 END)

FormulaBasic:
  (CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*[LOAN_AMT])/100 ELSE  [LOAN_AMT] END) ELSE 0 END)

FormulaExtended:
  (CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)


FormulaKeyword: [Primary_Borrower_Display]
FormulaWithFunction:
  (CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN Convert(varchar(50),@option_value_7)  ELSE  'Share is same for both applicant' END) ELSE 'NA' END)

FormulaBasic:
  (CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN Convert(varchar(50),@option_value_7)  ELSE  'Share is same for both applicant' END) ELSE 'NA' END)

FormulaExtended:
  (CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN Convert(varchar(50),@option_value_7)  ELSE  'Share is same for both applicant' END) ELSE 'NA' END)


FormulaKeyword: [Secondary_Borrower_Display]
FormulaWithFunction:
  (CASE WHEN @Pr_Option_6 = 25 THEN Convert(varchar(50),Round([Secondary_Borrower_Share],0)) ELSE 'Not Applicable' END)

FormulaBasic:
  (CASE WHEN @Pr_Option_6 = 25 THEN Convert(varchar(50),Round([Secondary_Borrower_Share],0)) ELSE 'Not Applicable' END)

FormulaExtended:
  (CASE WHEN @Pr_Option_6 = 25 THEN Convert(varchar(50),Round(((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)),0)) ELSE 'Not Applicable' END)


FormulaKeyword: [Secondary_Borrower_Gender]
FormulaWithFunction:
  (CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_OPTION_10 = 31 THEN 'Male' Else 'Female' END) ELSE Convert(Varchar(50),-998) END)

FormulaBasic:
  (CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_OPTION_10 = 31 THEN 'Male' Else 'Female' END) ELSE Convert(Varchar(50),-998) END)

FormulaExtended:
  (CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_OPTION_10 = 31 THEN 'Male' Else 'Female' END) ELSE Convert(Varchar(50),-998) END)


FormulaKeyword: [Secondary_Borrower_Rate]
FormulaWithFunction:
  (CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END)

FormulaBasic:
  (CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END)

FormulaExtended:
  (CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END)


FormulaKeyword: [Secondary_RATE_TAX]
FormulaWithFunction: ([Secondary_Borrower_Rate]*(1+[TAX_1]))/1000
FormulaBasic: ([Secondary_Borrower_Rate]*(1+[TAX_1]))/1000
FormulaExtended:
  (((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000


FormulaKeyword: [Primary_Prem_Fund]
FormulaWithFunction:
  (CASE WHEN @Pr_OPTION_5=21 THEN ([Primary_Borrower_Share]*((@Option_Value_5)*([Primary_RATE_TAX])))*(1+((1/(1-([Primary_RATE_TAX]*@Pr_PPT)))-1)) ELSE 0 END)

FormulaBasic:
  (CASE WHEN @Pr_OPTION_5=21 THEN ([Primary_Borrower_Share]*((@Option_Value_5)*([Primary_RATE_TAX])))*(1+((1/(1-([Primary_RATE_TAX]*@Pr_PPT)))-1)) ELSE 0 END)

FormulaExtended:
  (CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)


FormulaKeyword: [Secondary_Prem_Fund]
FormulaWithFunction:
  (CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN ([Secondary_Borrower_Share]*((@Option_Value_5)*([Secondary_RATE_TAX])))*(1+((1/(1-([Secondary_RATE_TAX]*@Pr_PPT)))-1)) ELSE 0 END)

FormulaBasic:
  (CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN ([Secondary_Borrower_Share]*((@Option_Value_5)*([Secondary_RATE_TAX])))*(1+((1/(1-([Secondary_RATE_TAX]*@Pr_PPT)))-1)) ELSE 0 END)

FormulaExtended:
  (CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)


FormulaKeyword: [SA_Primary]
FormulaWithFunction:
  (min(CEILING((([Primary_Borrower_Share] + [Primary_Prem_Fund] + (CASE WHEN @Pr_Option_7=26 THEN [Secondary_Prem_Fund]  ELSE 0 END))/1000))*1000,1000000000))

FormulaBasic:
  ((SELECT MIN(v) FROM (VALUES (CEILING((([Primary_Borrower_Share] + [Primary_Prem_Fund] + (CASE WHEN @Pr_Option_7=26 THEN [Secondary_Prem_Fund]  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))

FormulaExtended:
  ((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))


FormulaKeyword: [SA_Secondary]
FormulaWithFunction:
  (min(CEILING((([Secondary_Borrower_Share] + [Secondary_Prem_Fund] + (CASE WHEN @Pr_Option_7=26 THEN [Primary_Prem_Fund]  ELSE 0 END))/1000))*1000,1000000000))

FormulaBasic:
  ((SELECT MIN(v) FROM (VALUES (CEILING((([Secondary_Borrower_Share] + [Secondary_Prem_Fund] + (CASE WHEN @Pr_Option_7=26 THEN [Primary_Prem_Fund]  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))

FormulaExtended:
  ((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))


FormulaKeyword: [HSAD_Primary]
FormulaWithFunction:
  (SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and [SA_Primary] between FromSa AND ToSa)

FormulaBasic:
  (SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and [SA_Primary] between FromSa AND ToSa)

FormulaExtended:
  (SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))) between FromSa AND ToSa)


FormulaKeyword: [HSAD_Secondary]
FormulaWithFunction:
  (CASE WHEN @Pr_Option_6 = 25  THEN (SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and [SA_Secondary] between FromSa AND ToSa) ELSE 0 END)

FormulaBasic:
  (CASE WHEN @Pr_Option_6 = 25  THEN (SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and [SA_Secondary] between FromSa AND ToSa) ELSE 0 END)

FormulaExtended:
  (CASE WHEN @Pr_Option_6 = 25  THEN (SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))) between FromSa AND ToSa) ELSE 0 END)


FormulaKeyword: [ANN_PREM_Primary]
FormulaWithFunction: round(((@Prem_Rate)*[SA_Primary]*(1-[HSAD_Primary]-[JL_Rebate])*(1-[Staff_Disc]))/1000,2)
FormulaBasic: round(((@Prem_Rate)*[SA_Primary]*(1-[HSAD_Primary]-[JL_Rebate])*(1-[Staff_Disc]))/1000,2)
FormulaExtended:
  round(((@Prem_Rate)*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))*(1-((SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))) between FromSa AND ToSa))-((CASE WHEN @Pr_Option_6 = 25 AND @Pr_Option_7 = 26 THEN ( 0.05) ELSE 0 END)))*(1-((CASE WHEN @is_staff = 1 THEN 0.075 ELSE 0 END))))/1000,2)


FormulaKeyword: [ANN_PREM_Secondary]
FormulaWithFunction:
  round((([Secondary_Borrower_Rate])*[SA_Secondary]*(1-[HSAD_Secondary]-[JL_Rebate])*(1-[Staff_Disc]))/1000,2)

FormulaBasic:
  round((([Secondary_Borrower_Rate])*[SA_Secondary]*(1-[HSAD_Secondary]-[JL_Rebate])*(1-[Staff_Disc]))/1000,2)

FormulaExtended:
  round(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))*(1-((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))) between FromSa AND ToSa) ELSE 0 END))-((CASE WHEN @Pr_Option_6 = 25 AND @Pr_Option_7 = 26 THEN ( 0.05) ELSE 0 END)))*(1-((CASE WHEN @is_staff = 1 THEN 0.075 ELSE 0 END))))/1000,2)


FormulaKeyword: [ANN_PREM]
FormulaWithFunction: ([ANN_PREM_Primary] + [ANN_PREM_Secondary])
FormulaBasic: ([ANN_PREM_Primary] + [ANN_PREM_Secondary])
FormulaExtended:
  ((round(((@Prem_Rate)*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))*(1-((SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))) between FromSa AND ToSa))-((CASE WHEN @Pr_Option_6 = 25 AND @Pr_Option_7 = 26 THEN ( 0.05) ELSE 0 END)))*(1-((CASE WHEN @is_staff = 1 THEN 0.075 ELSE 0 END))))/1000,2)) + (round(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))*(1-((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))) between FromSa AND ToSa) ELSE 0 END))-((CASE WHEN @Pr_Option_6 = 25 AND @Pr_Option_7 = 26 THEN ( 0.05) ELSE 0 END)))*(1-((CASE WHEN @is_staff = 1 THEN 0.075 ELSE 0 END))))/1000,2)))


FormulaKeyword: [MODAL_PREM_Primary]
FormulaWithFunction: Round([ANN_PREM_Primary] * (@Mode_Disc),2)
FormulaBasic: Round([ANN_PREM_Primary] * (@Mode_Disc),2)
FormulaExtended:
  Round((round(((@Prem_Rate)*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))*(1-((SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))) between FromSa AND ToSa))-((CASE WHEN @Pr_Option_6 = 25 AND @Pr_Option_7 = 26 THEN ( 0.05) ELSE 0 END)))*(1-((CASE WHEN @is_staff = 1 THEN 0.075 ELSE 0 END))))/1000,2)) * (@Mode_Disc),2)


FormulaKeyword: [MODAL_PREM_Secondary]
FormulaWithFunction: Round([ANN_PREM_Secondary] * (@Mode_Disc),2)
FormulaBasic: Round([ANN_PREM_Secondary] * (@Mode_Disc),2)
FormulaExtended:
  Round((round(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))*(1-((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))) between FromSa AND ToSa) ELSE 0 END))-((CASE WHEN @Pr_Option_6 = 25 AND @Pr_Option_7 = 26 THEN ( 0.05) ELSE 0 END)))*(1-((CASE WHEN @is_staff = 1 THEN 0.075 ELSE 0 END))))/1000,2)) * (@Mode_Disc),2)


FormulaKeyword: [MODAL_PREM]
FormulaWithFunction: ([MODAL_PREM_Primary] + [MODAL_PREM_Secondary])
FormulaBasic: ([MODAL_PREM_Primary] + [MODAL_PREM_Secondary])
FormulaExtended:
  ((Round((round(((@Prem_Rate)*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))*(1-((SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))) between FromSa AND ToSa))-((CASE WHEN @Pr_Option_6 = 25 AND @Pr_Option_7 = 26 THEN ( 0.05) ELSE 0 END)))*(1-((CASE WHEN @is_staff = 1 THEN 0.075 ELSE 0 END))))/1000,2)) * (@Mode_Disc),2)) + (Round((round(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))*(1-((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))) between FromSa AND ToSa) ELSE 0 END))-((CASE WHEN @Pr_Option_6 = 25 AND @Pr_Option_7 = 26 THEN ( 0.05) ELSE 0 END)))*(1-((CASE WHEN @is_staff = 1 THEN 0.075 ELSE 0 END))))/1000,2)) * (@Mode_Disc),2)))


FormulaKeyword: [MODAL_PREM_TAX]
FormulaWithFunction: ([MODAL_PREM]) + [TAX_MP]
FormulaBasic: ([MODAL_PREM]) + [TAX_MP]
FormulaExtended:
  ((((Round((round(((@Prem_Rate)*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))*(1-((SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))) between FromSa AND ToSa))-((CASE WHEN @Pr_Option_6 = 25 AND @Pr_Option_7 = 26 THEN ( 0.05) ELSE 0 END)))*(1-((CASE WHEN @is_staff = 1 THEN 0.075 ELSE 0 END))))/1000,2)) * (@Mode_Disc),2)) + (Round((round(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))*(1-((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))) between FromSa AND ToSa) ELSE 0 END))-((CASE WHEN @Pr_Option_6 = 25 AND @Pr_Option_7 = 26 THEN ( 0.05) ELSE 0 END)))*(1-((CASE WHEN @is_staff = 1 THEN 0.075 ELSE 0 END))))/1000,2)) * (@Mode_Disc),2))))) + (ROUND(((((Round((round(((@Prem_Rate)*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))*(1-((SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))) between FromSa AND ToSa))-((CASE WHEN @Pr_Option_6 = 25 AND @Pr_Option_7 = 26 THEN ( 0.05) ELSE 0 END)))*(1-((CASE WHEN @is_staff = 1 THEN 0.075 ELSE 0 END))))/1000,2)) * (@Mode_Disc),2)) + (Round((round(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))*(1-((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))) between FromSa AND ToSa) ELSE 0 END))-((CASE WHEN @Pr_Option_6 = 25 AND @Pr_Option_7 = 26 THEN ( 0.05) ELSE 0 END)))*(1-((CASE WHEN @is_staff = 1 THEN 0.075 ELSE 0 END))))/1000,2)) * (@Mode_Disc),2)))) * ((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))),2))


FormulaKeyword: [SA]
FormulaWithFunction:
  (CASE WHEN @Pr_Option_6 = 25 AND @Pr_Option_7 = 27 THEN Min([SA_Primary],[SA_Secondary]) ELSE [SA_Primary] END)

FormulaBasic:
  (CASE WHEN @Pr_Option_6 = 25 AND @Pr_Option_7 = 27 THEN (SELECT MIN(v) FROM (VALUES ([SA_Primary]),([SA_Secondary])) AS value(v)) ELSE [SA_Primary] END)

FormulaExtended:
  (CASE WHEN @Pr_Option_6 = 25 AND @Pr_Option_7 = 27 THEN (SELECT MIN(v) FROM (VALUES ((((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))),((((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))))) AS value(v)) ELSE (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))) END)


FormulaKeyword: [ANN_PREM_YEARLY]
FormulaWithFunction: (CASE WHEN PolicyYear < @Pr_PPT THEN [MODAL_PREM]*(@Mode_Freq) ELSE 0 END)
FormulaBasic: (CASE WHEN PolicyYear < @Pr_PPT THEN [MODAL_PREM]*(@Mode_Freq) ELSE 0 END)
FormulaExtended:
  (CASE WHEN PolicyYear < @Pr_PPT THEN (((Round((round(((@Prem_Rate)*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))*(1-((SELECt DiscountRate from LSAdMaster where productid = @Pr_Id and (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END)) + ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))) between FromSa AND ToSa))-((CASE WHEN @Pr_Option_6 = 25 AND @Pr_Option_7 = 26 THEN ( 0.05) ELSE 0 END)))*(1-((CASE WHEN @is_staff = 1 THEN 0.075 ELSE 0 END))))/1000,2)) * (@Mode_Disc),2)) + (Round((round(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END)))*(((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v))))*(1-((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT DiscountRate from LSAdMaster where productid = @Pr_Id and (((SELECT MIN(v) FROM (VALUES (CEILING(((((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END)) + ((CASE WHEN @Pr_OPTION_5 = 21 AND @Pr_Option_6 = 25  THEN (((CASE WHEN @Pr_Option_6 = 25 THEN (CASE WHEN @Pr_Option_7 = 27 THEN ((100-@option_value_7)*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END) ELSE 0 END))*((@Option_Value_5)*(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((((CASE WHEN @Pr_Option_6 = 25  THEN (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @option_value_6 AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END)) ELSE 0 END))*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END)) + (CASE WHEN @Pr_Option_7=26 THEN ((CASE WHEN @Pr_OPTION_5=21 THEN (((CASE WHEN @Pr_Option_6 =25 AND @Pr_Option_7 =27 THEN (@option_value_7*((@Pr_Loan_Amt)))/100 ELSE  ((@Pr_Loan_Amt)) END))*((@Option_Value_5)*(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000))))*(1+((1/(1-(((@Prem_Rate*(1+((select isnull(Rate,0) as Rate from TaxStructure where getdate() between FromDate and isnull(Todate, getdate()) and PolicyYear between FromYear and ToYear and TaxGroup = isnull(@TaxGroup, 0) and TaxKeyword = 'TAX_1'))))/1000)*@Pr_PPT)))-1)) ELSE 0 END))  ELSE 0 END))/1000))*1000),(1000000000)) AS value(v)))) between FromSa AND ToSa) ELSE 0 END))-((CASE WHEN @Pr_Option_6 = 25 AND @Pr_Option_7 = 26 THEN ( 0.05) ELSE 0 END)))*(1-((CASE WHEN @is_staff = 1 THEN 0.075 ELSE 0 END))))/1000,2)) * (@Mode_Disc),2))))*(@Mode_Freq) ELSE 0 END)


FormulaKeyword: [PremiumRate]
FormulaWithFunction:
  (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END) )

FormulaBasic:
  (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END) )

FormulaExtended:
  (SELECT RATE FROM Premiumrates where ProductId = @Pr_Id AND LAAGE = @LI_Entry_Age AND PT = @Pr_PT AND PPT = @Pr_PPT and Optionid = @Pr_Option_3 and SAUpper = @Pr_Option_2  AND Field1 = (CASE WHEN @Pr_OPTION_3 = 14 THEN 0 ELSE @Pr_Option_4 END) )


FormulaKeyword: [TFS]
FormulaWithFunction:
  (SELECT Rate from RateTable1 where ProductId = @PR_ID and 
   OptionId = (CASE WHEN @PR_OPTION_1 <=3 THEN @PR_OPTION_1 ELSE @PR_OPTION_2 END) and PT = 1)

FormulaBasic:
  (SELECT Rate from RateTable1 where ProductId = @PR_ID and 
   OptionId = (CASE WHEN @PR_OPTION_1 <=3 THEN @PR_OPTION_1 ELSE @PR_OPTION_2 END) and PT = 1)

FormulaExtended:
  (SELECT Rate from RateTable1 where ProductId = @PR_ID and 
   OptionId = (CASE WHEN @PR_OPTION_1 <=3 THEN @PR_OPTION_1 ELSE @PR_OPTION_2 END) and PT = 1)


FormulaKeyword: [CON_PPT]
FormulaWithFunction:
  (CASE WHEN @LI_GENDER='F' AND @PR_OPTION_1>=4 THEN (CASE WHEN @PR_PPT=65 THEN MIN(40,@PR_PPT-@LI_ENTRY_AGE+2) ELSE MIN(50,@PR_PPT-@LI_ENTRY_AGE+2) END)

FormulaBasic:
  (CASE WHEN @LI_GENDER='F' AND @PR_OPTION_1>=4 THEN (CASE WHEN @PR_PPT=65 THEN (SELECT MIN(v) FROM (VALUES (40),(@PR_PPT-@LI_ENTRY_AGE+2)) AS value(v)) ELSE (SELECT MIN(v) FROM (VALUES (50),(@PR_PPT-@LI_ENTRY_AGE+2)) AS value(v)) END)

FormulaExtended:
  (CASE WHEN @LI_GENDER='F' AND @PR_OPTION_1>=4 THEN (CASE WHEN @PR_PPT=65 THEN (SELECT MIN(v) FROM (VALUES (40),(@PR_PPT-@LI_ENTRY_AGE+2)) AS value(v)) ELSE (SELECT MIN(v) FROM (VALUES (50),(@PR_PPT-@LI_ENTRY_AGE+2)) AS value(v)) END)


FormulaKeyword: [CON_PPT]
FormulaWithFunction:
  (CASE WHEN @LI_GENDER='F' AND @PR_OPTION_1>=4 THEN (CASE WHEN (@PR_PPT=65) THEN (CASE WHEN 40<((CASE WHEN (@PR_PPT=65) THEN (65-(@LI_ENTRY_AGE)) ELSE (CASE WHEN @PR_PPT=75 THEN (75-@LI_ENTRY_AGE) ELSE @PR_PPT END) END)+2) THEN 40 ELSE ((CASE WHEN (@PR_PPT=65) THEN (65-(@LI_ENTRY_AGE)) ELSE (CASE WHEN @PR_PPT=75 THEN (75-@LI_ENTRY_AGE) ELSE @PR_PPT END) END)+2) END) ELSE (CASE WHEN 50<((CASE WHEN (@PR_PPT=65) THEN (65-(@LI_ENTRY_AGE)) ELSE (CASE WHEN @PR_PPT=75 THEN (75-@LI_ENTRY_AGE) ELSE @PR_PPT END) END)+2) THEN 50 ELSE ((CASE WHEN (@PR_PPT=65) THEN (65-(@LI_ENTRY_AGE)) ELSE (CASE WHEN @PR_PPT=75 THEN (75-@LI_ENTRY_AGE) ELSE @PR_PPT END) END)+2) END) END) ELSE (CASE WHEN @PR_PPT=1 OR (@PR_OPTION_1>=4 AND (@PR_PPT=65 OR @PR_PPT=75)) THEN (CASE WHEN (@PR_PPT=65) THEN (65-(@LI_ENTRY_AGE)) ELSE (CASE WHEN @PR_PPT=75 THEN (75-@LI_ENTRY_AGE) ELSE @PR_PPT END) END) ELSE (CASE WHEN @PR_PT=100 THEN (100-(@LI_ENTRY_AGE)) ELSE @PR_PT END)  END) END)

FormulaBasic:
  (CASE WHEN @LI_GENDER='F' AND @PR_OPTION_1>=4 THEN (CASE WHEN (@PR_PPT=65) THEN (CASE WHEN 40<((CASE WHEN (@PR_PPT=65) THEN (65-(@LI_ENTRY_AGE)) ELSE (CASE WHEN @PR_PPT=75 THEN (75-@LI_ENTRY_AGE) ELSE @PR_PPT END) END)+2) THEN 40 ELSE ((CASE WHEN (@PR_PPT=65) THEN (65-(@LI_ENTRY_AGE)) ELSE (CASE WHEN @PR_PPT=75 THEN (75-@LI_ENTRY_AGE) ELSE @PR_PPT END) END)+2) END) ELSE (CASE WHEN 50<((CASE WHEN (@PR_PPT=65) THEN (65-(@LI_ENTRY_AGE)) ELSE (CASE WHEN @PR_PPT=75 THEN (75-@LI_ENTRY_AGE) ELSE @PR_PPT END) END)+2) THEN 50 ELSE ((CASE WHEN (@PR_PPT=65) THEN (65-(@LI_ENTRY_AGE)) ELSE (CASE WHEN @PR_PPT=75 THEN (75-@LI_ENTRY_AGE) ELSE @PR_PPT END) END)+2) END) END) ELSE (CASE WHEN @PR_PPT=1 OR (@PR_OPTION_1>=4 AND (@PR_PPT=65 OR @PR_PPT=75)) THEN (CASE WHEN (@PR_PPT=65) THEN (65-(@LI_ENTRY_AGE)) ELSE (CASE WHEN @PR_PPT=75 THEN (75-@LI_ENTRY_AGE) ELSE @PR_PPT END) END) ELSE (CASE WHEN @PR_PT=100 THEN (100-(@LI_ENTRY_AGE)) ELSE @PR_PT END)  END) END)

FormulaExtended:
  (CASE WHEN @LI_GENDER='F' AND @PR_OPTION_1>=4 THEN (CASE WHEN (@PR_PPT=65) THEN (CASE WHEN 40<((CASE WHEN (@PR_PPT=65) THEN (65-(@LI_ENTRY_AGE)) ELSE (CASE WHEN @PR_PPT=75 THEN (75-@LI_ENTRY_AGE) ELSE @PR_PPT END) END)+2) THEN 40 ELSE ((CASE WHEN (@PR_PPT=65) THEN (65-(@LI_ENTRY_AGE)) ELSE (CASE WHEN @PR_PPT=75 THEN (75-@LI_ENTRY_AGE) ELSE @PR_PPT END) END)+2) END) ELSE (CASE WHEN 50<((CASE WHEN (@PR_PPT=65) THEN (65-(@LI_ENTRY_AGE)) ELSE (CASE WHEN @PR_PPT=75 THEN (75-@LI_ENTRY_AGE) ELSE @PR_PPT END) END)+2) THEN 50 ELSE ((CASE WHEN (@PR_PPT=65) THEN (65-(@LI_ENTRY_AGE)) ELSE (CASE WHEN @PR_PPT=75 THEN (75-@LI_ENTRY_AGE) ELSE @PR_PPT END) END)+2) END) END) ELSE (CASE WHEN @PR_PPT=1 OR (@PR_OPTION_1>=4 AND (@PR_PPT=65 OR @PR_PPT=75)) THEN (CASE WHEN (@PR_PPT=65) THEN (65-(@LI_ENTRY_AGE)) ELSE (CASE WHEN @PR_PPT=75 THEN (75-@LI_ENTRY_AGE) ELSE @PR_PPT END) END) ELSE (CASE WHEN @PR_PT=100 THEN (100-(@LI_ENTRY_AGE)) ELSE @PR_PT END)  END) END)


FormulaKeyword: [Fund_GA_RATE_2]
FormulaWithFunction:
  CASE WHEN PolicyYear>=6 AND PolicyYear<= (@Pr_PPT) 
   AND PolicyMonth=12 AND @Pr_PPT>5  THEN 0.0015 ELSE 0 END

FormulaBasic:
  CASE WHEN PolicyYear>=6 
   AND PolicyYear<= (@Pr_PPT) AND PolicyMonth=12 AND @Pr_PPT>5  THEN 0.0015 ELSE 0 END

FormulaExtended:
  CASE WHEN PolicyYear>=6 AND PolicyYear<= (@Pr_PPT) AND PolicyMonth=12 AND @Pr_PPT>5 
   THEN 0.0015 ELSE 0 END


FormulaKeyword: [Fund_GA_RATE_3]
FormulaWithFunction:
  CASE WHEN PolicyYear>=10 AND (PolicyYear%5) =0 AND PolicyMonth=12 THEN  (CASE WHEN PolicyYear <= 15 THEN 0.0275 ELSE 0.035 END ) ELSE 0 END

FormulaBasic:
  CASE WHEN PolicyYear>=10 AND (PolicyYear%5) =0 AND PolicyMonth=12 THEN  (CASE WHEN PolicyYear <= 15 THEN 0.0275 ELSE 0.035 END ) ELSE 0 END

FormulaExtended:
  CASE WHEN PolicyYear>=10 AND (PolicyYear%5) =0 AND PolicyMonth=12 THEN  (CASE WHEN PolicyYear <= 15 THEN 0.0275 ELSE 0.035 END ) ELSE 0 END


