SELECT
ServiceInvoiceLineItem.serviceInvoiceLineItemID,
ServiceInvoiceLineItem.serviceInvoiceID,
ServiceInvoiceLineItem.referenceNo,
ServiceInvoiceLineItem.externalReferenceNo,
ServiceInvoiceLineItem.saReferenceNo,
ServiceInvoiceLineItem.serviceID,
ServiceInvoiceLineItem.serviceDateFrom,
ServiceInvoiceLineItem.serviceDateTo,
ServiceInvoiceLineItem.noOfUnits,
ServiceInvoiceLineItem.unitAmount,
ServiceInvoiceLineItem.amountInvoiced,
ServiceInvoiceLineItem.caseReferenceNo,
ServiceInvoiceLineItem.caseID,
ServiceInvoiceLineItem.clientReferenceNo,
ServiceInvoiceLineItem.clientID,
ServiceInvoiceLineItem.clientFirstName,
ServiceInvoiceLineItem.clientLastName,
ServiceInvoiceLineItem.clientDOB,
ServiceInvoiceLineItem.providerReferenceNo,
ServiceInvoiceLineItem.providerID,
ServiceInvoiceLineItem.providerName,
ServiceInvoiceLineItem.payeeReferenceNo,
ServiceInvoiceLineItem.payeeID,
ServiceInvoiceLineItem.payeeName,
ServiceInvoiceLineItem.status,
ServiceInvoiceLineItem.serviceAuthorizationLIID,
ServiceInvoiceLineItem.expProInd,
ServiceInvoiceLineItem.allowDuplicateSILI,
ServiceInvoiceLineItem.payeeNameUpper,
ServiceInvoiceLineItem.validityStatus,
ServiceInvoiceLineItem.versionNo
INTO
:serviceInvoiceLineItemID,
:serviceInvoiceID,
:referenceNo,
:externalReferenceNo,
:saReferenceNo,
:serviceID,
:serviceDateFrom,
:serviceDateTo,
:noOfUnits,
:unitAmount,
:amountInvoiced,
:caseReferenceNo,
:caseID,
:clientReferenceNo,
:clientID,
:clientFirstName,
:clientLastName,
:clientDOB,
:providerReferenceNo,
:providerID,
:providerName,
:payeeReferenceNo,
:payeeID,
:payeeName,
:status,
:serviceAuthorizationLIID,
:expProInd,
:allowDuplicateSILI,
:payeeNameUpper,
:validityStatus,
:versionNo
FROM
ServiceInvoice,
ServiceInvoiceLineItem
WHERE ServiceInvoiceLineItem.serviceInvoiceID = :serviceInvoiceID
AND ServiceInvoiceLineItem.serviceInvoiceID = ServiceInvoice.serviceInvoiceID
AND
(
ServiceInvoice.originatorID = :providerID
OR
(
ServiceInvoiceLineItem.payeeID = :payeeID
OR ServiceInvoiceLineItem.providerID = :providerID
)
)
|