forked from kevinrosendaal/Snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPag50100.APIPostedSInvoiceB64.al
45 lines (42 loc) · 1.23 KB
/
Pag50100.APIPostedSInvoiceB64.al
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
page 50100 "API - Posted S. Invoice B64"
{
PageType = API;
APIPublisher = 'kevinrosendaal';
APIGroup = 'sample';
APIVersion = 'v1.0';
EntityName = 'postedSalesInvoiceB64';
EntitySetName = 'postedSalesInvoiceB64';
SourceTable = "Sales Invoice Header";
ODataKeyFields = SystemId;
Editable = false;
InsertAllowed = false;
ModifyAllowed = false;
DeleteAllowed = false;
layout
{
area(Content)
{
repeater(Invoices)
{
field(systemId; Rec.SystemId) { }
field(base64; Base64) { }
}
}
}
trigger OnAfterGetRecord()
var
ReportSelections: Record "Report Selections";
TempBlob: Codeunit "Temp Blob";
InStr: InStream;
begin
if Rec.Count > 1 then
Error('Specify Invoice ID.');
ReportSelections.GetPdfReportForCust(TempBlob, Enum::"Report Selection Usage"::"S.Invoice", Rec, Rec."Bill-to Customer No.");
TempBlob.CreateInStream(InStr);
Base64 := Base64Convert.ToBase64(InStr);
end;
var
Base64Convert: Codeunit "Base64 Convert";
SalesInvoiceNo: Code[20];
Base64: Text;
}