Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/AL-Go-Settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"runs-on": "windows-latest",
"cacheImageName": "",
"UsePsSession": false,
"artifact": "https://bcinsider-fvh2ekdjecfjd6gk.b02.azurefd.net/sandbox/28.0.40773.0/base",
"artifact": "https://bcinsider-fvh2ekdjecfjd6gk.b02.azurefd.net/sandbox/28.0.41461.0/base",
"country": "base",
"useProjectDependencies": true,
"repoVersion": "28.0",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ codeunit 31252 "Data Class. Eval. Handler CZA"
AssemblyLine: Record "Assembly Line";
AssemblySetup: Record "Assembly Setup";
#endif
CopyItemBuffer: Record "Copy Item Buffer";
CapacityLedgerEntry: Record "Capacity Ledger Entry";
DataExchFieldMapping: Record "Data Exch. Field Mapping";
DefaultDimension: Record "Default Dimension";
Expand Down Expand Up @@ -79,6 +80,7 @@ codeunit 31252 "Data Class. Eval. Handler CZA"
#pragma warning restore AL0432
#endif
DataClassificationMgt.SetFieldToNormal(Database::"Capacity Ledger Entry", CapacityLedgerEntry.FieldNo("User ID CZA"));
DataClassificationMgt.SetFieldToNormal(Database::"Copy Item Buffer", CopyItemBuffer.FieldNo("Auto Create Dimension CZA"));
DataClassificationMgt.SetFieldToNormal(Database::"Data Exch. Field Mapping", DataExchFieldMapping.FieldNo("Date Formula CZA"));
DataClassificationMgt.SetFieldToNormal(Database::"Default Dimension", DefaultDimension.FieldNo("Automatic Create CZA"));
DataClassificationMgt.SetFieldToNormal(Database::"Default Dimension", DefaultDimension.FieldNo("Dim. Description Field ID CZA"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,31 @@ codeunit 31392 "Default Dimension Handler CZA"
until AutoDefaultDimension.Next() = 0;
end;

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Copy Item", 'OnCopyItemOnBeforeTargetItemInsert', '', false, false)]
local procedure ItemCopyOnCopyItemOnBeforeTargetItemInsert(var CopyItemBuffer: Record "Copy Item Buffer")
var
AutoDefaultDimension: Record "Default Dimension";
begin
if not CopyItemBuffer.Dimensions then
exit;

AutoDefaultDimension.SetRange("Table ID", Database::Item);
AutoDefaultDimension.SetRange("No.", '');
AutoDefaultDimension.SetRange("Automatic Create CZA", true);
if AutoDefaultDimension.IsEmpty() then
exit;

CopyItemBuffer.Dimensions := false;
CopyItemBuffer."Auto Create Dimension CZA" := true;
end;

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Copy Item", 'OnAfterCopyItem', '', false, false)]
local procedure ItemCopyOnAfterCopyItem(var CopyItemBuffer: Record "Copy Item Buffer"; SourceItem: Record Item; var TargetItem: Record Item)
begin
if CopyItemBuffer."Auto Create Dimension CZA" then
CopyItemDimensions(SourceItem, TargetItem."No.");
end;

local procedure SetRequestRunFalse(TableID: Integer)
begin
case TableID of
Expand Down Expand Up @@ -378,6 +403,23 @@ codeunit 31392 "Default Dimension Handler CZA"
end;
end;

local procedure CopyItemDimensions(FromItem: Record Item; ToItemNo: Code[20])
var
DefaultDimension: Record "Default Dimension";
NewDefaultDimension: Record "Default Dimension";
begin
DefaultDimension.SetRange("Table ID", Database::Item);
DefaultDimension.SetRange("No.", FromItem."No.");
if DefaultDimension.FindSet() then
repeat
if not NewDefaultDimension.Get(Database::Item, ToItemNo, DefaultDimension."Dimension Code") then begin
NewDefaultDimension.TransferFields(DefaultDimension);
NewDefaultDimension."No." := ToItemNo;
NewDefaultDimension.Insert();
end;
until DefaultDimension.Next() = 0;
end;

var
DimensionAutoUpdateMgtCZA: Codeunit "Dimension Auto.Update Mgt. CZA";
}
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ codeunit 31370 "G/L Entry Post Application CZA"
local procedure IsAppliedEntry(GLEntry: Record "G/L Entry"; ApplyingGLEntry: Record "G/L Entry") IsOk: Boolean
begin
IsOk :=
(GLEntry."Entry No." <> ApplyingGLEntry."Entry No.") and
(GLEntry."G/L Account No." = ApplyingGLEntry."G/L Account No.") and
((GLEntry.Amount <> 0) and ((GLEntry.Amount * ApplyingGLEntry.Amount) < 0)) or
(GLEntry.Amount = 0);
((GLEntry.Amount * ApplyingGLEntry.Amount) <= 0);
OnAfterIsAppliedEntry(GLEntry, ApplyingGLEntry, IsOk);
end;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Microsoft.Inventory.Item;

tableextension 31073 "Copy Item Buffer CZA" extends "Copy Item Buffer"
{
fields
{
field(31238; "Auto Create Dimension CZA"; Boolean)
{
Caption = 'Auto Create Dimension';
DataClassification = SystemMetadata;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ codeunit 31362 "Match Bank Payment CZB"
SummaryGenJournalLine: Record "Gen. Journal Line";
BankAccountNo: Code[20];
MinAmount, MaxAmount : Decimal;
AppliesToIDTok: Label '%1%2', Locked = true, MaxLength = 50;

local procedure Code()
begin
Expand Down Expand Up @@ -205,7 +206,8 @@ codeunit 31362 "Match Bank Payment CZB"
GenJournalLine.Validate("Applies-to Doc. Type", TempMatchBankPaymentBufferCZB."Document Type");
GenJournalLine.SetSuppressCommit(true);
GenJournalLine.Validate("Applies-to Doc. No.", TempMatchBankPaymentBufferCZB."Document No.");
end;
end else
GenJournalLine.Validate("Applies-to ID", BuildAppliesToID(GenJournalLine));
if BankAccount."Dimension from Apply Entry CZB" then
GenJournalLine.Validate("Dimension Set ID", TempMatchBankPaymentBufferCZB."Dimension Set ID");
if GenJournalLine."Currency Code" <> OriginalGenJournalLine."Currency Code" then
Expand Down Expand Up @@ -488,6 +490,11 @@ codeunit 31362 "Match Bank Payment CZB"
MaxAmount := Round(MaxAmount);
end;

local procedure BuildAppliesToID(GenJournalLine: Record "Gen. Journal Line"): Code[50]
begin
exit(CopyStr(StrSubstNo(AppliesToIDTok, GenJournalLine."Document No.", Format(GenJournalLine."Line No.")), 1, MaxStrLen(GenJournalLine."Applies-to ID")));
end;

[IntegrationEvent(false, false)]
local procedure OnAfterFillMatchBankPaymentBuffer(var TempMatchBankPaymentBufferCZB: Record "Match Bank Payment Buffer CZB"; SearchRuleLineCZB: Record "Search Rule Line CZB"; var GenJournalLine: Record "Gen. Journal Line"; MinAmount: Decimal; MaxAmount: Decimal)
begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ codeunit 31037 "Bank Operations Functions CZL"
IdentificationIncorrectChecksumErr: Label 'Bank account identification has incorrect checksum.';
FirstHyphenErr: Label 'Bank account no. must not start with character "-".';

procedure CreateVariableSymbol(Input: Code[35]): Code[10]
procedure CreateVariableSymbol(Input: Code[35]) VariableSymbol: Code[10]
begin
if Input = '' then
exit('');
exit(CopyStr(TrimLeft(NumbersOnly(Input), '0'), 1, 10));
VariableSymbol := CopyStr(TrimLeft(NumbersOnly(Input), '0'), 1, 10);
OnCreateVariableSymbol(Input, VariableSymbol);
end;

local procedure NumbersOnly(Input: Text): Text
Expand Down Expand Up @@ -223,4 +222,9 @@ codeunit 31037 "Bank Operations Functions CZL"

exit(OutputSum mod 11);
end;

[IntegrationEvent(false, false)]
local procedure OnCreateVariableSymbol(Input: Code[35]; var VariableSymbol: Code[10])
begin
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,10 @@ codeunit 11748 "Install Application CZL"
CloseBalanceSheetSourceCodeTxt: Label 'CLBALANCE', MaxLength = 10;
CloseBalanceSheetSourceCodeDescriptionTxt: Label 'Close Balance Sheet', MaxLength = 100;
begin
if not SourceCodeSetup.Get() then
if not SourceCodeSetup.Get() then begin
SourceCodeSetup.Init();
SourceCodeSetup.Insert();
end;
PrevSourceCodeSetup := SourceCodeSetup;
InsertSourceCode(SourceCodeSetup."Purchase VAT Delay CZL", PurchaseVATDelaySourceCodeTxt, PurchaseVATDelaySourceCodeDescriptionTxt);
InsertSourceCode(SourceCodeSetup."Sales VAT Delay CZL", SalesVATDelaySourceCodeTxt, SalesVATDelaySourceCodeDescriptionTxt);
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,7 @@ codeunit 13916 "Export XRechnung Document"
begin
CompanyInformation.Get();
GeneralLedgerSetup.Get();
OnAfterGetSetups(CompanyInformation, GeneralLedgerSetup);
end;
#endregion

Expand Down Expand Up @@ -1205,6 +1206,11 @@ codeunit 13916 "Export XRechnung Document"
begin
end;

[IntegrationEvent(false, false)]
local procedure OnAfterGetSetups(var CompanyInformation: Record "Company Information"; var GeneralLedgerSetup: Record "General Ledger Setup")
begin
end;

[IntegrationEvent(false, false)]
local procedure OnBeforeInsertInvoiceLine(var InvoiceElement: XmlElement; var SalesInvLine: Record "Sales Invoice Line"; Currency: Record Currency; CurrencyCode: Code[10]; PricesIncVAT: Boolean; var IsHandled: Boolean)
begin
Expand All @@ -1224,5 +1230,4 @@ codeunit 13916 "Export XRechnung Document"
local procedure OnBeforeAddCrMemoLineElement(var CrMemoLineElement: XmlElement; var SalesCrMemoLine: Record "Sales Cr.Memo Line"; Currency: Record Currency; CurrencyCode: Code[10]; PricesIncVAT: Boolean)
begin
end;

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ using System.IO;
using Microsoft.Sales.Customer;
using Microsoft.Foundation.Company;
using Microsoft.eServices.EDocument;
using Microsoft.eServices.EDocument.IO.Peppol;
using Microsoft.Service.History;
using Microsoft.eServices.EDocument.IO.Peppol;

codeunit 13914 "XRechnung Format" implements "E-Document"
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,7 @@ codeunit 13917 "Export ZUGFeRD Document"
begin
CompanyInformation.Get();
GeneralLedgerSetup.Get();
OnAfterGetSetups(CompanyInformation, GeneralLedgerSetup);
end;

procedure FormatDate(VarDate: Date): Text[20];
Expand Down Expand Up @@ -1007,6 +1008,11 @@ codeunit 13917 "Export ZUGFeRD Document"
begin
end;

[IntegrationEvent(false, false)]
local procedure OnAfterGetSetups(var CompanyInformation: Record "Company Information"; var GeneralLedgerSetup: Record "General Ledger Setup")
begin
end;

[IntegrationEvent(false, false)]
local procedure OnBeforeInsertInvoiceLine(var SupplyChainTradeTransactionElement: XmlElement; var SalesInvoiceLine: Record "Sales Invoice Line"; Currency: Record Currency; CurrencyCode: Code[10]; PricesIncVAT: Boolean; var IsHandled: Boolean)
begin
Expand Down Expand Up @@ -1038,4 +1044,4 @@ codeunit 13917 "Export ZUGFeRD Document"
begin
CreateZUGFeRDXML := true;
end;
}
}
11 changes: 10 additions & 1 deletion Apps/DE/EDocumentDE/app/src/ZUGFeRD/ZUGFeRDFormat.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
namespace Microsoft.eServices.EDocument.Formats;

using System.Utilities;
using Microsoft.eServices.EDocument.IO.Peppol;
using Microsoft.Foundation.Company;
using Microsoft.Sales.Customer;
using Microsoft.Sales.History;
using Microsoft.Purchases.Document;
using Microsoft.eServices.EDocument;
using Microsoft.Service.History;
using System.IO;
using Microsoft.eServices.EDocument.IO.Peppol;

codeunit 13920 "ZUGFeRD Format" implements "E-Document"
{
Expand Down Expand Up @@ -136,6 +137,14 @@ codeunit 13920 "ZUGFeRD Format" implements "E-Document"
if not EDocumentService."Buyer Reference Mandatory" then
exit;

if not (SourceDocumentHeader.Number in
[Database::"Sales Invoice Header",
Database::"Sales Cr.Memo Header",
Database::"Service Invoice Header",
Database::"Service Cr.Memo Header"])
then
exit;

case EDocumentService."Buyer Reference" of
EDocumentService."Buyer Reference"::"Customer Reference":
begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ namespace Microsoft.eServices.EDocument.Formats;
using Microsoft.Foundation.Company;
using Microsoft.Sales.Customer;
using Microsoft.Sales.History;
using Microsoft.Purchases.Vendor;
using Microsoft.Purchases.Document;
using System.Utilities;
using Microsoft.Bank.BankAccount;
using System.Reflection;
Expand Down Expand Up @@ -34,6 +36,7 @@ codeunit 13922 "ZUGFeRD XML Document Tests"
GeneralLedgerSetup: Record "General Ledger Setup";
EDocumentService: Record "E-Document Service";
LibraryTestInitialize: Codeunit "Library - Test Initialize";
LibraryPurchase: Codeunit "Library - Purchase";
LibrarySales: Codeunit "Library - Sales";
LibraryInventory: Codeunit "Library - Inventory";
LibraryRandom: Codeunit "Library - Random";
Expand Down Expand Up @@ -587,6 +590,47 @@ codeunit 13922 "ZUGFeRD XML Document Tests"
VerifyCrMemoLineWithDiscounts(SalesCrMemoHeader, TempXMLBuffer);
end;
#endregion

#region PurchaseInvoice
[Test]
procedure ReleasePurchaseInvoiceInZUGFeRDFormat();
var
PurchaseHeader: Record "Purchase Header";
begin
// [SCENARIO] Release purchase invoice regardless if ZUGFeRD format is setup with customer reference
Initialize();

// [GIVEN] Set Buyer reference = customer reference
SetEdocumentServiceBuyerReference("E-Document Buyer Reference"::"Customer Reference");

// [WHEN] Create and release Purchase Invoice
CreatePurchDocument(PurchaseHeader, "Purchase Document Type"::Invoice);
LibraryPurchase.ReleasePurchaseDocument(PurchaseHeader);

// [THEN] No error occurs
end;
#endregion

#region PurchaseCreditMemo
[Test]
procedure ReleasePurchaseCreditMemoInZUGFeRDFormat();
var
PurchaseHeader: Record "Purchase Header";
begin
// [SCENARIO] Release purchase credit memo regardless if ZUGFeRD format is setup with customer reference
Initialize();

// [GIVEN] Set Buyer reference = customer reference
SetEdocumentServiceBuyerReference("E-Document Buyer Reference"::"Customer Reference");

// [WHEN] Create and release Purchase credit Memo
CreatePurchDocument(PurchaseHeader, "Purchase Document Type"::"Credit Memo");
LibraryPurchase.ReleasePurchaseDocument(PurchaseHeader);

// [THEN] No error occurs
end;
#endregion

local procedure CreateAndPostSalesDocument(DocumentType: Enum "Sales Document Type"; LineType: Enum "Sales Line Type"; InvoiceDiscount: Boolean): Code[20];
var
SalesHeader: Record "Sales Header";
Expand All @@ -611,6 +655,27 @@ codeunit 13922 "ZUGFeRD XML Document Tests"
exit(LibrarySales.PostSalesDocument(SalesHeader, true, true));
end;

local procedure CreatePurchDocument(var PurchaseHeader: Record "Purchase Header"; DocumentType: Enum "Purchase Document Type")
var
PurchaseLine: Record "Purchase Line";
begin
CreatePurchHeader(PurchaseHeader, DocumentType);
LibraryPurchase.CreatePurchaseLine(
PurchaseLine, PurchaseHeader, PurchaseLine.Type::Item, LibraryInventory.CreateItemNo(), LibraryRandom.RandInt(10));
PurchaseLine.Validate("Direct Unit Cost", LibraryRandom.RandDec(50, 2));
PurchaseLine.Modify(true);
end;

local procedure CreatePurchHeader(var PurchaseHeader: Record "Purchase Header"; DocumentType: Enum "Purchase Document Type")
var
Vendor: Record Vendor;
begin
LibraryPurchase.CreateVendor(Vendor);
LibraryPurchase.CreatePurchHeader(PurchaseHeader, DocumentType, Vendor."No.");
PurchaseHeader.Validate("Vendor Invoice No.", PurchaseHeader."No.");
PurchaseHeader.Modify(true);
end;

local procedure CreateSalesDocumentWithLine(DocumentType: Enum "Sales Document Type"; LineType: Enum "Sales Line Type"; InvoiceDiscount: Boolean): Code[20];
var
SalesHeader: Record "Sales Header";
Expand Down Expand Up @@ -1240,5 +1305,4 @@ codeunit 13922 "ZUGFeRD XML Document Tests"

LibraryTestInitialize.OnAfterTestSuiteInitialize(Codeunit::"ZUGFeRD XML Document Tests");
end;
}

}
6 changes: 6 additions & 0 deletions Apps/DK/EDocumentFormatOIOUBL/app/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
"name": "E-Document Core",
"publisher": "Microsoft",
"version": "28.0.0.0"
},
{
"id": "b3780cd9-f8f8-4a83-a4d5-0c2ad87b28af",
"name": "Sustainability",
"publisher": "Microsoft",
"version": "28.0.0.0"
}
],
"screenshots": [],
Expand Down
Loading
Loading