Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,14 @@ Any output you generate, such as reasoning text, MUST be in the following output
- Lower confidence for cross-category matches even if descriptions contain similar terms


### Reasoning:
### Reasoning:

**Reasoning Text Instruction Template (Human-Readable Historical Match)**

When generating reasoning text, write as if explaining to the user why the system recognized this as the same item or account based on historical purchases.
Keep it short (under 250 characters), human, and natural.
When generating reasoning text, write as if explaining to the user why the system recognized this as the item or account based on historical purchases.

**General Template**

> “Matched to [item/account name] because [main reason: same/similar description, code, or pattern], purchased from [vendor name] on [date or time reference, e.g. ‘2 weeks ago’].”

> "Matches a previous purchase of [item/account name] from [vendor] recorded on [date or time reference]. [main reason: same/similar description, code, or pattern] indicates same type of purchase."
If vendor is not present, omit it naturally:

> “Matched to [item/account name] because [main reason], last purchased [time reference].”

If account match (not item):

> “Matched to account [account name] used for [main reason/context] from [vendor name] [time reference].”

> "Matches a previous purchase of [item/account name] recorded on [date or time reference]. [main reason: same/similar description, code, or pattern] indicates same type of purchase."

Return a match **only when** appropriate by calling "match_lines_historical" function.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ codeunit 6117 "E-Doc. Create Purchase Invoice" implements IEDocumentFinishDraft,
PurchaseHeader.SetRange("Buy-from Vendor No.", EDocumentPurchaseHeader."[BC] Vendor No."); // Setting the filter, so that the insert trigger assigns the right vendor to the purchase header
PurchaseHeader."Document Type" := "Purchase Document Type"::Invoice;
PurchaseHeader."Pay-to Vendor No." := EDocumentPurchaseHeader."[BC] Vendor No.";
PurchaseHeader."Posting Description" := EDocumentPurchaseHeader."Posting Description";

VendorInvoiceNo := CopyStr(EDocumentPurchaseHeader."Sales Invoice No.", 1, MaxStrLen(PurchaseHeader."Vendor Invoice No."));
VendorLedgerEntry.SetLoadFields("Entry No.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ codeunit 6124 "E-Doc. Providers" implements IPurchaseLineProvider, IUnitOfMeasur
EDocumentPurchaseLine.Validate("[BC] Item Reference No.", ItemReference."Reference No.");
EDocImpSessionTelemetry.SetLineBool(EDocumentPurchaseLine.SystemId, 'Item Reference ', true);

SetActivityLog(EDocumentPurchaseLine.SystemId, EDocumentPurchaseLine.FieldNo("[BC] Item Reference No."), StrSubstNo(ItemReferenceReasonMsg, VendorNo), ItemReference, Page::"Item References", StrSubstNo(ItemReferenceSourceMsg, ItemReference."Reference No."), ActivityLog);
SetActivityLog(EDocumentPurchaseLine.SystemId, EDocumentPurchaseLine.FieldNo("[BC] Purchase Type No."), StrSubstNo(ItemReferenceReasonMsg, VendorNo), ItemReference, Page::"Item References", StrSubstNo(ItemReferenceSourceMsg, ItemReference."Reference No."), ActivityLog);
EDocActivityLogSession.Set(EDocActivityLogSession.ItemRefTok(), ActivityLog);
exit;
end;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace Microsoft.eServices.EDocument.Processing.Import.Purchase;
using Microsoft.eServices.EDocument;
using Microsoft.eServices.EDocument.Processing.Import;
using Microsoft.Finance.Dimension;
using Microsoft.Inventory.Item.Catalog;
using Microsoft.Purchases.Document;
using Microsoft.Purchases.History;

Expand Down Expand Up @@ -69,6 +70,7 @@ page 6183 "E-Doc. Purchase Draft Subform"
{
ApplicationArea = All;
Lookup = true;
Visible = false;
}
field("Unit Of Measure"; Rec."[BC] Unit of Measure")
{
Expand Down Expand Up @@ -294,6 +296,25 @@ page 6183 "E-Doc. Purchase Draft Subform"
Rec.LookupDimensions();
end;
}
action(LookupItemReferences)
{
ApplicationArea = All;
Caption = 'Item References';
ToolTip = 'View item references for the vendor associated with this e-document.';
Image = Change;

trigger OnAction()
var
ItemReference: Record "Item Reference";
ItemReferencePage: Page "Item Reference Entries";
begin
EDocumentPurchaseHeader.TestField("[BC] Vendor No.");
ItemReference.SetRange("Reference Type", ItemReference."Reference Type"::Vendor);
ItemReference.SetRange("Reference Type No.", EDocumentPurchaseHeader."[BC] Vendor No.");
ItemReferencePage.SetTableView(ItemReference);
ItemReferencePage.Run();
end;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ page 6181 "E-Document Purchase Draft"

field(Record; RecordLinkTxt)
{
Caption = 'Finalized Document';
Caption = 'Purchase Document';
Editable = false;
Importance = Promoted;
ToolTip = 'Specifies the record, document, journal line, or ledger entry, that is linked to the electronic document.';
Expand Down Expand Up @@ -120,6 +120,19 @@ page 6181 "E-Document Purchase Draft"
CurrPage.Update();
end;
}
field("Posting Description"; EDocumentPurchaseHeader."Posting Description")
{
Importance = Promoted;
Caption = 'Posting Description';
ToolTip = 'Specifies the extracted posting description for the document.';
Editable = true;

trigger OnValidate()
begin
EDocumentPurchaseHeader.Modify();
CurrPage.Update();
end;
}
field("Document Date"; EDocumentPurchaseHeader."Document Date")
{
Caption = 'Document Date';
Expand Down Expand Up @@ -418,6 +431,7 @@ page 6181 "E-Document Purchase Draft"
Caption = 'Process';
actionref(Promoted_CreateDocument; CreateDocument)
{
Visible = false;
}
actionref(Promoted_AnalyseDocument; AnalyzeDocument)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ table 6100 "E-Document Purchase Header"
Caption = 'Vendor Contact Name';
DataClassification = CustomerContent;
}
field(38; "Posting Description"; Text[100])
{
Caption = 'Posting Description';
DataClassification = CustomerContent;
}
#endregion Purchase fields

#region Business Central Data - Validated fields [101-200]
Expand Down
Loading