Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[E-Documents Core] - E-Invoice Preview FastTab #10

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

GMatuleviciute
Copy link
Owner

@GMatuleviciute GMatuleviciute commented Jan 22, 2025

Implementation

This update allows users to preview incoming electronic invoices before creating a purchase document. The preview provides a non-editable view of invoice lines while header information remains in its existing section.
New FastTab "E-Invoice Lines" appears immediately below "Service Status" FastTab and is visible only if:

Direction = Incoming

Document Type = Invoice or Credit Memo

This feature provides users a quick and efficient way to review invoice details before creating purchase documents, ensuring accuracy and reducing manual errors.

MS PR: microsoft#27977

Copy link
Collaborator

@tinestaric tinestaric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! Only a few minor things to address :P

@@ -493,6 +500,7 @@ page 6121 "E-Document"
begin
IsProcessed := Rec.Status = Rec.Status::Processed;
IsIncomingDoc := Rec.Direction = Rec.Direction::Incoming;
ShowPreview := (Rec."Document Type" = Rec."Document Type"::"Purchase Invoice") or (Rec."Document Type" = Rec."Document Type"::"Purchase Credit Memo");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, preference: you could also use "Document Type" in [Invoice, Credit Memo]. But this is really just a preference :P

@@ -597,7 +605,7 @@ page 6121 "E-Document"
EDocumentHelper: Codeunit "E-Document Processing";
ErrorsAndWarningsNotification: Notification;
RecordLinkTxt, StyleStatusTxt : Text;
ShowRelink, ShowMapToOrder, HasErrorsOrWarnings, HasErrors, IsIncomingDoc, IsProcessed, CopilotVisible : Boolean;
ShowRelink, ShowMapToOrder, HasErrorsOrWarnings, HasErrors, IsIncomingDoc, IsProcessed, CopilotVisible, ShowPreview : Boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This is getting a bit long...

{
field("No."; Rec."No.")
{
ToolTip = 'Specifies what is being purchased.';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move tooltips to the table

@@ -0,0 +1,53 @@
table 6100 "E-Invoice Line"
{
DataClassification = CustomerContent;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a caption

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preference: I'd like to also see explicit property for extensible and accessible. Regardless if it's true or false. It means we thought about it and didn't just forget it. Same for pages.

@@ -0,0 +1,43 @@
page 6100 "E-Invoice Lines"
{
PageType = ListPart;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

page caption

if not EInvoiceLine.IsEmpty() then
EInvoiceLine.DeleteAll(true);

if (EDocument."Document Type" <> EDocument."Document Type"::"Purchase Invoice") and (EDocument."Document Type" <> EDocument."Document Type"::"Purchase Credit Memo") then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, preference: not DocType in [Invoice, CrMemo]

OnAfterPrepareReceivedDoc(EDocument, TempBlob, SourceDocumentHeader, SourceDocumentLine, TempEDocMapping);
end;

local procedure CreateEInvoiceLinesPreview(EDocument: Record "E-Document"; SourceDocumentLine: RecordRef)
var
EDocumentImportHelper: Codeunit "E-Document Import Helper";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused var

OnAfterPrepareReceivedDoc(EDocument, TempBlob, SourceDocumentHeader, SourceDocumentLine, TempEDocMapping);
end;

local procedure CreateEInvoiceLinesPreview(EDocument: Record "E-Document"; SourceDocumentLine: RecordRef)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Hmm, this naming implies more of the "posting preview" behavior. So, actual lines would be created, but in the end reverted. Maybe CreateEInvoicePreviewLines? Would it be better to name the table accordingly as well?


if SourceDocumentLine.FindSet() then
repeat
EInvoiceLine.Init();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, preference: extract the content of the repeat loop into a local procedure, to make it cleaner.

TempXMLBuffer.SetRange(Path, '/Invoice/cac:AccountingSupplierParty/cac:Party/cbc:EndpointID');
TempXMLBuffer.FindFirst();
TempXMLBuffer.Value := DocumentVendor."VAT Registration No.";
TempXMLBuffer.Modify();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implicit runtrigger

@nerkel91
Copy link
Collaborator

Implementation

This update allows users to preview incoming electronic invoices before creating a purchase document. The preview provides a non-editable view of invoice lines while header information remains in its existing section.
New FastTab "E-Invoice Lines" appears immediately below "Service Status" FastTab and is visible only if:

  • Direction = Incoming

  • Document Type = Invoice or Credit Memo

This feature provides users a quick and efficient way to review invoice details before creating purchase documents, ensuring accuracy and reducing manual errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants