Operation Details
Description: Reads the performance measure against all utilization contracts for the provider. @deprecated since 7.0.0.0, This functionality forms part of a feature that is no longer relevant to the product strategy and will not be replaced.
Sterotype: ns
SQL
SELECT
  SUM(paymentAmt)
INTO
  :count 
FROM
  
  ( 
  SELECT
    SUM(InstructionLineItem.amount) AS paymentAmt 
  FROM
    CaseDecisionFinancialComp,
    CaseDecisionObjective,
    InstructionLineItem 
  WHERE CaseDecisionFinancialComp.caseDecisionObjectiveID = CaseDecisionObjective.caseDecisionObjectiveID 
    AND InstructionLineItem.financialCompID = CaseDecisionFinancialComp.financialCompID 
    AND CaseDecisionObjective.relatedReference IN 
    ( 
    SELECT
      CAST(ServiceInvoiceLineItem.serviceInvoiceLineItemID AS CHAR(20)) 
    FROM
      ServiceInvoiceLineItem,
      ProviderOffering,
      ServiceOffering ,
     ContractVersion
    WHERE  ContractVersion.contractVersionID = :resourceID 
	 AND ProviderOffering.providerConcernRoleID = ContractVersion.concernRoleID
      AND ProviderOffering.serviceOfferingID = ServiceOffering.serviceOfferingID 
      AND ServiceInvoiceLineItem.serviceID = ServiceOffering.serviceOfferingID 
      AND ProviderOffering.providerOfferingID IN 
      ( 
      SELECT
        ContractPOLink.providerOfferingID 
      FROM
        UtilizationContract,
        ContractVersion,
        ContractPOLink 
      WHERE ContractVersion.contractVersionID = :resourceID 
         AND ContractVersion.contractType = :contractType 
        AND ContractVersion.status = :contractStatus 
        AND ContractVersion.contractVersionID = ContractPOLink.contractVersionID 
         AND UtilizationContract.contractVersionID = ContractVersion.contractVersionID 
    
      )  AND
                  (
                  ServiceInvoiceLineItem.ServiceDateFrom BETWEEN ContractVersion.startDate AND                           ContractVersion.endDate
	             OR ServiceInvoiceLineItem.serviceDateTo BETWEEN ContractVersion.startDate AND                         ContractVersion.endDate
	              OR ContractVersion.startDate BETWEEN ServiceInvoiceLineItem.ServiceDateFrom AND                               ServiceInvoiceLineItem.serviceDateTo
	               OR ContractVersion.endDate  BETWEEN ServiceInvoiceLineItem.ServiceDateFrom AND                             ServiceInvoiceLineItem.serviceDateTo 
                )
    ) 
    AND InstructionLineItem.instructionLineItemType = :siliInstructionLineItemType 
    AND InstructionLineItem.instructLineItemCategory = :instructLineItemCategory 
    AND InstructionLineItem.statusCode = :statusCode 
  
  UNION ALL
    
  SELECT
    SUM(InstructionLineItem.amount) AS paymentAmt 
  FROM
    CaseDecisionFinancialComp,
    CaseDecisionObjective,
    InstructionLineItem 
  WHERE CaseDecisionFinancialComp.caseDecisionObjectiveID = CaseDecisionObjective.caseDecisionObjectiveID 
    AND InstructionLineItem.financialCompID = CaseDecisionFinancialComp.financialCompID 
    AND CaseDecisionObjective.relatedReference IN 
    ( 
    SELECT
      CAST(ProviderRosterLineItem.providerRosterLineItemID AS CHAR(20)) 
    FROM
      ProviderRosterLineItem,
      RosterLineItem,
      Roster,
     ContractVersion	  
    WHERE ContractVersion.contractVersionID = :resourceID  
	 AND Roster.concernRoleID = ContractVersion.concernRoleID
      AND Roster.rosterID = RosterLineItem.rosterID 
      AND RosterLineItem.rosterLineItemID = ProviderRosterLineItem.rosterLineItemID 
      AND Roster.serviceID IN 
      ( 
      SELECT
        ContractPOLink.providerOfferingID 
      FROM
        UtilizationContract,
        ContractVersion,
        ContractPOLink 
      WHERE ContractVersion.contractVersionID = :resourceID  
	    AND ContractVersion.contractType = :contractType 
        AND ContractVersion.status = :contractStatus 
        AND ContractVersion.contractVersionID = ContractPOLink.contractVersionID 
        AND UtilizationContract.contractVersionID = ContractVersion.contractVersionID 

    ) AND (RosterLineItem.serviceFrom BETWEEN ContractVersion.startDate AND ContractVersion.endDate
	  OR RosterLineItem.serviceTo BETWEEN ContractVersion.startDate AND ContractVersion.endDate
	  OR ContractVersion.startDate BETWEEN RosterLineItem.serviceFrom AND RosterLineItem.serviceTo
	  OR ContractVersion.endDate  BETWEEN RosterLineItem.serviceFrom AND RosterLineItem.serviceTo)
      ) 
    AND InstructionLineItem.instructionLineItemType = :rosterInstructionLineItemType 
    AND InstructionLineItem.instructLineItemCategory = :instructLineItemCategory 
    AND InstructionLineItem.statusCode = :statusCode 
  ) InstructionLineItem