
[dbo].[EmailApiGetOutgoingEmailInvoiceAttachments]
CREATE PROCEDURE [dbo].[EmailApiGetOutgoingEmailInvoiceAttachments]
@inOutgoingEmailIds IntList readonly
AS
begin
set nocount on
select
OutgoingEmailId = OutgoingEmailIds.Item,
Content = InvoicedImage.InvoicedImage,
InvoiceNumber = InvoicedHeader.InvoiceNumber,
FileExtension = ReportArchiveType.FileExtension,
AttachmentPosition = OutgoingEmailInvoiceAttachment.AttachmentOrder
from @inOutgoingEmailIds OutgoingEmailIds
inner join OutgoingEmailInvoiceAttachment on OutgoingEmailIds.Item = OutgoingEmailInvoiceAttachment.OutgoingEmailFID
inner join InvoicedHeader on OutgoingEmailInvoiceAttachment.InvoicedHeaderFID = InvoicedHeader.IHPriKey
inner join InvoicedImage on InvoicedHeader.IHPriKey = InvoicedImage.InvoicedHeaderFID
inner join ReportArchiveType on InvoicedImage.ReportArchiveTypeFID = ReportArchiveType.ReportArchiveTypeID
end
GO
GRANT EXECUTE ON [dbo].[EmailApiGetOutgoingEmailInvoiceAttachments] TO [MssExec]
GO