Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added src/Apps/NA/Peppol/App/ExtensionLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions src/Apps/NA/Peppol/App/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"id": "a3b1f5e9-8d2c-4a5e-9f3b-7c1d4e6a8b0c",
"name": "NA PEPPOL",
"publisher": "Microsoft",
"description": "North America specific PEPPOL implementation that extends the base PEPPOL functionality with regional customizations.",
"brief": "NA specific PEPPOL 3.0 electronic invoicing customizations.",
"version": "28.0.0.0",
"logo": "ExtensionLogo.png",
"privacyStatement": "https://go.microsoft.com/fwlink/?LinkId=724009",
"EULA": "https://go.microsoft.com/fwlink/?linkid=2009120",
"help": "https://go.microsoft.com/fwlink/?linkid=2104024",
"url": "https://go.microsoft.com/fwlink/?LinkId=724011",
"contextSensitiveHelpUrl": "https://go.microsoft.com/fwlink/?linkid=2206603",
"propagateDependencies": true,
"dependencies": [
{
"id": "e1966889-b5fb-4fda-a84c-ea71b590e1a9",
"name": "PEPPOL",
"publisher": "Microsoft",
"version": "28.0.0.0"
}
],
"internalsVisibleTo": [],
"platform": "28.0.0.0",
"idRanges": [
{
"from": 37301,
"to": 37350
}
],
"application": "28.0.0.0",
"features": [
"NoImplicitWith",
"TranslationFile"
],
"resourceExposurePolicy": {
"allowDebugging": true,
"allowDownloadingSource": true,
"includeSourceInSymbolFile": true
},
"target": "Cloud"
}
23 changes: 23 additions & 0 deletions src/Apps/NA/Peppol/App/src/NAPEPPOL30Format.EnumExt.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.Peppol;

enumextension 37301 "NA PEPPOL 3.0 Format" extends "PEPPOL 3.0 Format"
{
value(100; "NA PEPPOL 3.0 - Sales")
{
Caption = 'NA PEPPOL 3.0 - Sales';
Implementation = "PEPPOL Line Info Provider" = "NA PEPPOL Line Info Provider",
"PEPPOL30 Validation" = "PEPPOL30 Sales Validation",
"PEPPOL Posted Document Iterator" = "PEPPOL30 Sales Iterator";
}
value(101; "NA PEPPOL 3.0 - Service")
{
Caption = 'NA PEPPOL 3.0 - Service';
Implementation = "PEPPOL Line Info Provider" = "NA PEPPOL Line Info Provider",
"PEPPOL30 Validation" = "PEPPOL30 Service Validation",
"PEPPOL Posted Document Iterator" = "PEPPOL30 Services Iterator";
}
}
139 changes: 139 additions & 0 deletions src/Apps/NA/Peppol/App/src/NAPEPPOLLineInfoProvider.Codeunit.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.Peppol;

using Microsoft.Finance.GeneralLedger.Setup;
using Microsoft.Foundation.UOM;
using Microsoft.Sales.Document;

codeunit 37301 "NA PEPPOL Line Info Provider" implements "PEPPOL Line Info Provider"
{
InherentEntitlements = X;
InherentPermissions = X;
Access = Internal;

var
PEPPOL30: Codeunit "PEPPOL30";
NoUnitOfMeasureErr: Label 'The %1 %2 contains lines on which the %3 field is empty.', Comment = '%1: document type, %2: document no, %3 Unit of Measure Code';
UoMforPieceINUNECERec20ListIDTxt: Label 'C62', Locked = true;

procedure GetLineGeneralInfo(SalesLine: Record "Sales Line"; SalesHeader: Record "Sales Header"; var InvoiceLineID: Text; var InvoiceLineNote: Text; var InvoicedQuantity: Text; var InvoiceLineExtensionAmount: Text; var LineExtensionAmountCurrencyID: Text; var InvoiceLineAccountingCost: Text)
begin
PEPPOL30.GetLineGeneralInfo(SalesLine, SalesHeader, InvoiceLineID, InvoiceLineNote, InvoicedQuantity, InvoiceLineExtensionAmount, LineExtensionAmountCurrencyID, InvoiceLineAccountingCost);
end;

procedure GetLineUnitCodeInfo(SalesLine: Record "Sales Line"; var UnitCode: Text; var UnitCodeListID: Text)
var
UOM: Record "Unit of Measure";
begin
UnitCode := '';
UnitCodeListID := GetUNECERec20ListID();

if SalesLine.Quantity = 0 then begin
UnitCode := UoMforPieceINUNECERec20ListIDTxt; // unitCode is required
exit;
end;

case SalesLine.Type of
SalesLine.Type::Item, SalesLine.Type::Resource:
if UOM.Get(SalesLine."Unit of Measure Code") then
UnitCode := UOM."International Standard Code"
else
Error(NoUnitOfMeasureErr, SalesLine."Document Type", SalesLine."Document No.", SalesLine.FieldCaption("Unit of Measure Code"));
SalesLine.Type::"G/L Account", SalesLine.Type::"Fixed Asset", SalesLine.Type::"Charge (Item)":
if UOM.Get(SalesLine."Unit of Measure Code") then
UnitCode := UOM."International Standard Code"
else
UnitCode := UoMforPieceINUNECERec20ListIDTxt;
end;
end;

procedure GetLineInvoicePeriodInfo(var InvLineInvoicePeriodStartDate: Text; var InvLineInvoicePeriodEndDate: Text)
begin
PEPPOL30.GetLineInvoicePeriodInfo(InvLineInvoicePeriodStartDate, InvLineInvoicePeriodEndDate);
end;

procedure GetLineDeliveryInfo(var InvoiceLineActualDeliveryDate: Text; var InvoiceLineDeliveryID: Text; var InvoiceLineDeliveryIDSchemeID: Text)
begin
PEPPOL30.GetLineDeliveryInfo(InvoiceLineActualDeliveryDate, InvoiceLineDeliveryID, InvoiceLineDeliveryIDSchemeID);
end;

procedure GetLineDeliveryPostalAddr(var InvoiceLineDeliveryStreetName: Text; var InvLineDeliveryAddStreetName: Text; var InvoiceLineDeliveryCityName: Text; var InvoiceLineDeliveryPostalZone: Text; var InvLnDeliveryCountrySubentity: Text; var InvLnDeliveryCountryIdCode: Text; var InvLineDeliveryCountryListID: Text)
begin
PEPPOL30.GetLineDeliveryPostalAddr(InvoiceLineDeliveryStreetName, InvLineDeliveryAddStreetName, InvoiceLineDeliveryCityName, InvoiceLineDeliveryPostalZone, InvLnDeliveryCountrySubentity, InvLnDeliveryCountryIdCode, InvLineDeliveryCountryListID);
end;

procedure GetLineAllowanceChargeInfo(SalesLine: Record "Sales Line"; SalesHeader: Record "Sales Header"; var InvLnAllowanceChargeIndicator: Text; var InvLnAllowanceChargeReason: Text; var InvLnAllowanceChargeAmount: Text; var InvLnAllowanceChargeAmtCurrID: Text)
begin
PEPPOL30.GetLineAllowanceChargeInfo(SalesLine, SalesHeader, InvLnAllowanceChargeIndicator, InvLnAllowanceChargeReason, InvLnAllowanceChargeAmount, InvLnAllowanceChargeAmtCurrID);
end;

procedure GetLineTaxTotal(SalesLine: Record "Sales Line"; SalesHeader: Record "Sales Header"; var InvoiceLineTaxAmount: Text; var currencyID: Text)
begin
PEPPOL30.GetLineTaxTotal(SalesLine, SalesHeader, InvoiceLineTaxAmount, currencyID);
end;

procedure GetLineItemInfo(SalesLine: Record "Sales Line"; var Description: Text; var Name: Text; var SellersItemIdentificationID: Text; var StandardItemIdentificationID: Text; var StdItemIdIDSchemeID: Text; var OriginCountryIdCode: Text; var OriginCountryIdCodeListID: Text)
begin
PEPPOL30.GetLineItemInfo(SalesLine, Description, Name, SellersItemIdentificationID, StandardItemIdentificationID, StdItemIdIDSchemeID, OriginCountryIdCode, OriginCountryIdCodeListID);
end;

procedure GetLineItemCommodityClassificationInfo(var CommodityCode: Text; var CommodityCodeListID: Text; var ItemClassificationCode: Text; var ItemClassificationCodeListID: Text)
begin
PEPPOL30.GetLineItemCommodityClassificationInfo(CommodityCode, CommodityCodeListID, ItemClassificationCode, ItemClassificationCodeListID);
end;

procedure GetLineItemClassifiedTaxCategory(SalesLine: Record "Sales Line"; var ClassifiedTaxCategoryID: Text; var ItemSchemeID: Text; var InvoiceLineTaxPercent: Text; var ClassifiedTaxCategorySchemeID: Text)
begin
PEPPOL30.GetLineItemClassifiedTaxCategory(SalesLine, ClassifiedTaxCategoryID, ItemSchemeID, InvoiceLineTaxPercent, ClassifiedTaxCategorySchemeID);
end;

procedure GetLineItemClassifiedTaxCategoryBIS(SalesLine: Record "Sales Line"; var ClassifiedTaxCategoryID: Text; var ItemSchemeID: Text; var InvoiceLineTaxPercent: Text; var ClassifiedTaxCategorySchemeID: Text)
begin
PEPPOL30.GetLineItemClassifiedTaxCategoryBIS(SalesLine, ClassifiedTaxCategoryID, ItemSchemeID, InvoiceLineTaxPercent, ClassifiedTaxCategorySchemeID);
end;

procedure GetLineAdditionalItemPropertyInfo(SalesLine: Record "Sales Line"; var AdditionalItemPropertyName: Text; var AdditionalItemPropertyValue: Text)
begin
PEPPOL30.GetLineAdditionalItemPropertyInfo(SalesLine, AdditionalItemPropertyName, AdditionalItemPropertyValue);
end;

procedure GetLinePriceInfo(SalesLine: Record "Sales Line"; SalesHeader: Record "Sales Header"; var InvoiceLinePriceAmount: Text; var InvLinePriceAmountCurrencyID: Text; var BaseQuantity: Text; var UnitCode: Text)
var
VATBaseIdx: Decimal;
unitCodeListID: Text;
begin
if SalesHeader."Prices Including VAT" then begin
VATBaseIdx := 1 + SalesLine."VAT %" / 100;
InvoiceLinePriceAmount := Format(Round(SalesLine."Unit Price" / VATBaseIdx), 0, 9)
end else
InvoiceLinePriceAmount := Format(SalesLine."Unit Price", 0, 9);
InvLinePriceAmountCurrencyID := GetSalesDocCurrencyCode(SalesHeader);
BaseQuantity := '1';
GetLineUnitCodeInfo(SalesLine, UnitCode, unitCodeListID);
end;

procedure GetLinePriceAllowanceChargeInfo(var PriceChargeIndicator: Text; var PriceAllowanceChargeAmount: Text; var PriceAllowanceAmountCurrencyID: Text; var PriceAllowanceChargeBaseAmount: Text; var PriceAllowChargeBaseAmtCurrID: Text)
begin
PEPPOL30.GetLinePriceAllowanceChargeInfo(PriceChargeIndicator, PriceAllowanceChargeAmount, PriceAllowanceAmountCurrencyID, PriceAllowanceChargeBaseAmount, PriceAllowChargeBaseAmtCurrID);
end;

local procedure GetUNECERec20ListID(): Text
begin
exit('UNECERec20');
end;

local procedure GetSalesDocCurrencyCode(SalesHeader: Record "Sales Header"): Code[10]
var
GLSetup: Record "General Ledger Setup";
begin
if SalesHeader."Currency Code" = '' then begin
GLSetup.Get();
GLSetup.TestField("LCY Code");
exit(GLSetup."LCY Code");
end;
exit(SalesHeader."Currency Code");
end;
}
9 changes: 9 additions & 0 deletions src/Apps/NA/Peppol/NAPeppol.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"folders": [
{
"name": "App",
"path": "App"
}
],
"settings": {}
}