Procedure name | Description |
GetCompanyName(var CompanyInformation: Record "Company Information"): Text |
Chains the company information together with a fixed comma. |
GetUserInfo(var SystemCreatedByGuid: Guid; var UserName: Text; var UserTelephone: Text; var UserEmail: Text) |
The function uses the standard SystemCreatedBy field to provide the user information.
Full name -> comes from user table
Telephone number and email address -> come from the user setup table.
|
SetTotalLabels(var TotalInclVATText: Text; var TotalExclVATText: Text; CurrencyCode: Code[10]) |
Returns the predefined VAT headings.
Incl VAT label 'Total %1 large', 'Total amount %1 net'
Excl VAT label 'Total %1 net' , 'Total amount %1 gross'
The SetTotalLabels() function in the standard "Format Document" codeunit was used as a basis.
|
GetTotalInclVATLabelsWithCurrencyCode(TotalInclVATText: Text; CurrencyCode: Code[10]): Text |
Completes and returns a custom amount label with the currency code. If the currency code is empty, the "LCY Code" of the general ledger setup is used.
The label should contain the "...%1" percentage value. e.g.:
TotalInclVATText -> "Total %1" or "Total including VAT %1" etc.
|
GetTotalExclVATLabelsWithCurrencyCode(TotalExclVATText: Text; CurrencyCode: Code[10]): Text |
Completes and returns a custom net amount label with the currency code. If the currency code is empty, the "LCY Code" of the general ledger setup is used.
The label should contain the "...%1" percentage value. e.g.:
TotalExclVATText -> "Net amount %1" or "Net total %1" etc.
|
SetSalesPersonPurchaser(var SalespersonPurchaser: Record "Salesperson/Purchaser"; SalesPersonPurchaseCode: Code[20]) |
Returns the "Salesperson/Purchaser" record. |
SetPaymentTerms(var PaymentTerms: Record "Payment Terms"; PaymentTermsCode: Code[10]; LanguageCode: Code[10]) |
Returns the "Payment Terms" record. |
SetPaymentMethod(var PaymentMethod: Record "Payment Method"; PaymentMethodCode: Code[10]; LanguageCode: Code[10]) |
Returns the "Payment Method" record. |
SetShipmentMethod(var ShipmentMethod: Record "Shipment Method"; ShipmentMethodCode: Code[10]; LanguageCode: Code[10]) |
Returns the "Shipment Method" record. |
SetShippingAgentAndService(
var ShippingAgent: Record "Shipping Agent"; ShippingAgentCode: Code[10];
var ShippingAgentService: Record "Shipping Agent Services"; ShippingAgentServiceCode: Code[10]) |
Returns the following records in one command:
Delivery person, delivery person mode of transport
Shipping Agent, Shipping Agent Services
|
SetPaymentShipmentSalesPersonDocumentDetails(
var PaymentTerms: Record "Payment Terms"; PaymentTermsCode: Code[10];
var PaymentMethod: Record "Payment Method"; PaymentMethodCode: Code[10];
var ShipmentMethod: Record "Shipment Method"; ShipmentMethodCode: Code[10];
var SalespersonPurchaser: Record "Salesperson/Purchaser"; SalesPersonPurchaseCode: Code[20]; LanguageCode: Code[10]) |
Returns the following records in one function call:
Payment Terms , Payment Method, Shipment Method, Salesperson/Purchaser
|
GetContactEmailPhone(ContactNo: Code[20]) Result: Text |
Returns the contact's email address and phone number. The separator is a slash.
|
GetContactEmail(ContactNo: Code[20]) Result: Text |
Returns the email address of the contact.
|
GetContactPhoneContact(ContactNo: Code[20]) Result: Text |
The function returns the phone number of the contact.
|
GetFullCompanyName: Text |
The function returns the Name1 + Name2 of the CompanyInformation table.
|
GetCompanyTelephone: Text |
The function returns the phone number from the CompanyInformation table. Format = Phone Caption with colon + phone number
|
GetCompanyFax: Text |
The function returns the fax number from the CompanyInformation table. Format = Fax Caption with colon + fax number
|
GetCompanyEmail: Text |
The function returns the email address of the CompanyInformation table. Format = email caption with colon + email address
|
GetShortcutDimension1to8ValueName(ShortcutDimensionNo:Integer; DimSetID: Integer): Text |
The function returns the selected dimension value of the dimension entry. ShortcutDimensionNo = "Shortcut Dimension 1 Code".."Shortcut Dimension 8 Code" from GeneralLedgerSetup
|
GetNextPositionNumber(LineType: Integer; LineTypeNo: Code[20]; var PosNo: Integer; var IsHidePosNo: Boolean) |
The function returns the next position number of the document line. With the IsHidePosNo variable you can set dynamically the position value in the layout (show or hide).
|
GetCompanyPostCodeCityCountryName(): Text |
The function returns the post code, city and country name from the CompanyInformation. Format = "PostCode City / CountryName"
|
GetCompanyNameAddressPostCodeCity(): Text |
The function returns the full company name - with slash - from the CompanyInformation. Format = "Name / Address / PostCode City / CountryName"
|
GetCompanyPostCodeCity(): Text |
The function returns the post code and city from the CompanyInformation. Format = "PostCode City"
|
GetFullCompanyAddressWithPipeSeparator(): Text |
The function returns the company address from the CompanyInformation. Format = "Address | PostCode City | CountryName"
|
SetCurrencyCode(var CurrencyCode: Code[10]; DefaultCurrencyCode: Code[10]) |
Returns the currency code as a var parameter. DefaultCurrencyCode can also be empty or filled from the report header (with the "Currency Code").
add("Purchase Header")
{
column(CurrencyCode; CurrencyCode) { }
}
modify("Purchase Header")
{
trigger OnAfterAfterGetRecord()
begin
GeneralReportLibrary.SetCurrencyCode(CurrencyCode, "Purchase Header"."Currency Code");
end;
}
|
GetTrackingSpecification(RecordVariant: Variant; var TempTrackingSpecBuffer: Record "Tracking Specification" temporary; var TrackingSpecCount: Integer) |
The function collects and returns the item tracking datalines in the TempTrackingSpecBuffer variable.
RecordVariant currently recognizes the following objects:
"Sales Header", "Return Shipment Header", "Purchase Header", "Sales Invoice Header", "Sales Cr.Memo Header", "Sales Shipment Header"
For "Return Shipment Header": the function RetrieveTrackingReturnShipment() must be built into an EventHook and executed it.
Initialization:
modify(Header)
{
trigger OnAfterAfterGetRecord()
begin
GeneralReportLibrary.GetTrackingSpecification(Header, TempTrackingSpecBuffer, TrackingSpecCount1);
end;
}
Processing and preparation for the RDLC layout:
addbefore(AssemblyLine)
{
dataitem(HBRItemTrackingLine; "Integer")
{
DataItemTableView = SORTING(Number);
column(TrackingSpecBufferLotNo; TempTrackingSpecBuffer."Lot No.") { }
column(TrackingSpecBufferSerNo; TempTrackingSpecBuffer."Serial No.") { }
column(TrackingSpecBufferQty; TempTrackingSpecBuffer."Quantity (Base)") { }
column(TrackingSpecBufferUnitOfMeasure; TempTrackingSpecBuffer."Qty. per Unit of Measure") { }
trigger OnPreDataItem()
begin
if TrackingSpecCount1 = 0 then
CurrReport.Break();
TempTrackingSpecBuffer.SetCurrentKey("Source ID", "Source Type", "Source Subtype", "Source Batch Name", "Source Prod. Order Line", "Source Ref. No.");
TempTrackingSpecBuffer.SetRange("Source Ref. No.", Line."Line No.");
SetRange(Number, 1, TempTrackingSpecBuffer.Count());
end;
trigger OnAfterGetRecord()
begin
if Number = 1 then
TempTrackingSpecBuffer.FindSet()
else
TempTrackingSpecBuffer.Next();
end;
}
}
|
RetrieveTrackingReturnShipment(var TempTrackingSpecBuffer: Record "Tracking Specification" temporary; SourceID: Code[20]; var Found: Boolean) |
The procedure extends the "Item Tracking Doc. Management" codeunit and helps in collecting the item tracking lines.
If this function is executed in the hook, the GetTrackingSpecification() function finds the associated "Return Shipment Header" item tracking lines.
codeunit 50000 "AppEventHooksNVX"
{
var
GeneralReportLibrary: Codeunit GRLGeneralReportLibraryNVX;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Tracking Doc. Management", 'OnRetrieveDocumentItemTracking', '', true, true)]
local procedure "ItemTrackingDocManagement_OnRetrieveDocumentItemTracking"
(
var TempTrackingSpecBuffer: Record "Tracking Specification";
SourceID: Code[20];
var Found: Boolean;
SourceType: Integer;
SourceSubType: Option;
RetrieveAsmItemTracking: Boolean
)
begin
case SourceType of
Database::"Return Shipment Header":
GeneralReportLibrary.RetrieveTrackingReturnShipment(TempTrackingSpecBuffer, SourceID, Found);
end;
end;
}
|
IsArrayDifferentCompareArray1: array[8] of Text[100]; CompareArray2: array[8] of Text[100]) Result: Boolean |
The function compares two array variables.
|
GetSalesPerson(var SalesPerson: Record "Salesperson/Purchaser"; SalespersonCode: Code[20]) |
Returns the record of the "Salesperson/Purchaser" table.
|
PrintReportToLocalOrNetworkPrinterWithCommit(ReportId: Integer; RecIdToPrint: RecordId) |
In BC it is not possible (in a web client session) to print reports to an installed local or network printer.
This is already possible via the job queue. The function does nothing other than print the report on the printer set up in the printer selection.
report 50000 "WarehouseRegisterNVX"
{
Caption = 'Warehouse Register', comment = 'DEU="Lagerplatzjournal"';
DefaultLayout = RDLC;
RDLCLayout = './src/layout/WarehouseRegisterNVX.rdlc';
UsageCategory = Documents;
dataset
{
dataitem(Header; "Warehouse Register")
{
DataItemTableView = sorting("No.");
RequestFilterFields = "No.";
...
}
...
}
trigger OnPostReport()
var
GeneralReportLibrary: Codeunit GRLGeneralReportLibraryNVX;
begin
if not CurrReport.Preview then
GeneralReportLibrary.PrintReportToLocalOrNetworkPrinterWithCommit(Report::WarehouseRegisterNVX, Header.RecordId);
end;
}
|
ResetTotalValues(var TotalSubTotal: Decimal; var TotalInvDiscAmount: Decimal; var TotalAmount: Decimal; var TotalAmountVAT: Decimal; var TotalAmountInclVAT: Decimal) |
Resets the total block values of the posted invoice layout.
Indiv. Total functionality for the invoice. The procedure is related to the CalculateTotalValues() function.
|
ResetTotalValues(var TotalWeight: Decimal; var TotalAmount: Decimal; var TotalAmountVAT: Decimal; var TotalAmountInclVAT: Decimal) |
Resets the total block values of the proforma invoice.
Indiv. Total functionality for the proforma invoice. The procedure is related to the CalculateTotalValuesSalesProFormaInvoice() function.
|
CalculateTotalValues(var SalesInvoiceLine: Record "Sales Invoice Line"; var TotalSubTotal: Decimal; var TotalInvDiscAmount: Decimal; var TotalAmount: Decimal; var TotalAmountVAT: Decimal; var TotalAmountInclVAT: Decimal) |
Sums up the total block values of the posted invoice layout.
Indiv. Total functionality for the invoice. The procedure is related to the ResetTotalValues() function.
|
CalculateTotalValuesSalesProFormaInvoice(var SalesLine: Record "Sales Line"; var TotalWeight: Decimal; var TotalAmount: Decimal; var TotalAmountVAT: Decimal; var TotalAmountInclVAT: Decimal) |
Adds the total block values of the proforma invoice together.
Indiv. Total functionality for the proforma invoice. The procedure is related to the associated ResetTotalValues() function.
|
GetItemLederEntryNoFilter(DocumentNo: Code[20]; DocumentType: Enum "Item Ledger Document Type"; DocumentLineNo: Integer) Result: Text |
The function returns a filter string of the table ItemLedgerEntry."Entry No.". Example return value = "1|25|302|..."
|
GetCommaSeparatedAddressArray(AddressArray: array[8] of Text[100]; Number: Code[20]): Text |
Lists the address array values one after the other - with a comma separator. Format = "Array[1], Array[2], Array[3], Array[4], etc."
If the "Number" parameter is filled, the formatting changes and the address information is listed in brackets. Format = "Number (Array[1], Array[2], Array[3], Array[4], etc.)"
add(Header)
{
column(CommaSeparatedSellToAddress; GeneralReportLibrary.GetCommaSeparatedAddressArray(AddressArray, Header."Sell-to Customer No.")) { }
}
var
GeneralReportLibrary: Codeunit GRLGeneralReportLibraryNVX;
|
GetCountryRegionDescription(CountryRegionCode: Code[10]): Text |
The function returns the full name of the country. When fetching the data, the client language [Language.GetUserLanguageCode()] is will be taken.
|
This functionality provides a dynamic solution to populate the header data.
Here you have the option of defining and filling in several info blocks. The representation of the filled values on the RDLC side is possible with Tablix object.
1. Definition of the associated "Name/Value Buffer" DataItems.
With the columns
2. Own function in the report for filling the buffer table:
3. Function call on the OnAfterGetRecord() trigger:
4. Using it in the RDLC layout: