/* (non-Javadoc)
  * @see com.nyt.mpt.service.IPricingStatusCalculatorService#addAddedValueCheckForOption(com.nyt.mpt.domain.ProposalOption)
  */
 @Override
 public void addAddedValueCheckForOption(ProposalOption option) {
   Set<LineItem> lineItems = option.getLatestVersion().getProposalLineItemSet();
   if (lineItems != null && !lineItems.isEmpty()) {
     Double totalInvestment = getInvstmntOfQulfyngLI(lineItems, false);
     Double allowedPercentage =
         getAddedValueAllowed(
             totalInvestment,
             option.getProposal().getPriceType(),
             option.getProposal().getAgencyMargin());
     Double allowedDiscount = (totalInvestment * allowedPercentage) / 100;
     Double totalDiscountOffrd = getTotalDiscountOffered(lineItems);
     for (LineItem lineItem : lineItems) {
       if (!PricingStatus.PRICING_APPROVED.equals(lineItem.getPricingStatus())
           && lineItem.getPriceType().equals(LineItemPriceTypeEnum.ADDEDVALUE.getOptionValue())
           && lineItem.getViewabilityLevel()
               != LineItemViewableCriteriaEnum.VEIWABLE.getViewableValue()) {
         lineItem.setPricingStatus(
             (allowedDiscount < totalDiscountOffrd)
                 ? getPricingStatus(lineItem, option.getProposal().isSpecialAdvertiser())
                 : PricingStatus.SYSTEM_APPROVED);
         proposalDao.editLineItemsOfProposal(lineItem);
       }
     }
   }
 }
 /* (non-Javadoc)
  * @see com.nyt.mpt.service.IPricingStatusCalculatorService#addThreshHoldCheckForOption(com.nyt.mpt.domain.ProposalOption)
  */
 @Override
 public void addThreshHoldCheckForOption(ProposalOption option) {
   Set<LineItem> lineItems = option.getLatestVersion().getProposalLineItemSet();
   if (lineItems != null && !lineItems.isEmpty()) {
     Double totalInvestment = getInvstmntOfQulfyngLI(lineItems, true);
     if (option.getThresholdLimit() != null && option.getThresholdLimit() > totalInvestment) {
       for (LineItem lineItem : lineItems) {
         if (PricingStatus.PRICING_APPROVED.equals(lineItem.getPricingStatus())
             && lineItem.getViewabilityLevel()
                 != LineItemViewableCriteriaEnum.VEIWABLE.getViewableValue()) {
           lineItem.setPricingStatus(
               getPricingStatus(lineItem, option.getProposal().isSpecialAdvertiser()));
           proposalDao.editLineItemsOfProposal(lineItem);
         }
       }
     }
   }
 }