SELECT
ServiceInvoiceLineItem.amountInvoiced,
ServiceInvoiceLineItem.clientFirstName,
ServiceInvoiceLineItem.clientID,
ServiceInvoiceLineItem.clientLastName,
ServiceInvoiceLineItem.serviceDateFrom,
ServiceInvoiceLineItem.serviceDateTo,
ServiceInvoiceLineItem.serviceID,
ServiceInvoiceLineItem.serviceInvoiceID,
ServiceInvoiceLineItem.serviceInvoiceLineItemID,
ServiceInvoiceLineItem.status
INTO
:amountInvoiced,
:clientFirstName,
:clientID,
:clientLastName,
:serviceDateFrom,
:serviceDateTo,
:serviceID,
:serviceInvoiceID,
:serviceInvoiceLineItemID,
:status
FROM
ServiceInvoice INNER JOIN
ServiceInvoiceLineItem ON ServiceInvoiceLineItem.serviceInvoiceID = ServiceInvoice.serviceInvoiceID
where
ServiceInvoiceLineItem.serviceInvoiceID = :serviceInvoiceID
AND
(
ServiceInvoice.originatorID = :providerID
OR
(
ServiceInvoiceLineItem.payeeID = :payeeID
OR ServiceInvoiceLineItem.providerID = :providerID
)
)
|