-
Notifications
You must be signed in to change notification settings - Fork 0
[E-Document Core] - Extending the Core app with payments #5
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
3e81f6a
f4c11e2
26753b9
d89a2a0
be90cbf
9672d29
8f89380
0768d7d
9809c08
ac0892d
185f95a
89e251c
aee7aea
d6774b8
67671f4
498825b
b24c215
3cf281c
96b6d3c
d8c4999
e3ed73f
75d29ac
710a8e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ using Microsoft.eServices.EDocument.Payments; | |
| using System.Utilities; | ||
|
|
||
| /// <summary> | ||
| /// This codeunit is used to implement the "Document Payment Handler" interface. It is used to provide a default implementation for the "Action Invoker" interface. | ||
| /// This codeunit is used to provide a default implementation for the "Document Payment Handler" interface. | ||
| /// </summary> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Action Invoker? |
||
| codeunit 6105 "Empty Payment Handler" implements IDocumentPaymentHandler | ||
| { | ||
|
|
@@ -20,14 +20,17 @@ codeunit 6105 "Empty Payment Handler" implements IDocumentPaymentHandler | |
|
|
||
| procedure Send(var EDocument: Record "E-Document"; var EDocumentService: Record "E-Document Service"; PaymentContext: Codeunit PaymentContext) | ||
| begin | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit, preference: I prefer to see a // Do nothing comment within these placeholder implementations as it makes it clear this is intentionally empty. |
||
| // This method serves as a placeholder implementation for the IDocumentPaymentHandler interface. | ||
| end; | ||
|
|
||
| procedure Receive(var EDocument: Record "E-Document"; var EDocumentService: Record "E-Document Service"; var PaymentsMetadata: Codeunit "Temp Blob List"; PaymentContext: Codeunit PaymentContext) | ||
| begin | ||
| // This method serves as a placeholder implementation for the IDocumentPaymentHandler interface. | ||
| end; | ||
|
|
||
| procedure GetDetails(var EDocument: Record "E-Document"; var EDocumentService: Record "E-Document Service"; PaymentMetadata: Codeunit "Temp Blob"; PaymentContext: Codeunit PaymentContext) | ||
| begin | ||
| // This method serves as a placeholder implementation for the IDocumentPaymentHandler interface. | ||
| end; | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,20 +19,29 @@ table 6101 "E-Document Payment" | |
| { | ||
| Caption = 'E-Document Entry No.'; | ||
| TableRelation = "E-Document"."Entry No"; | ||
| AllowInCustomizations = Always; | ||
|
|
||
| trigger OnValidate() | ||
| begin | ||
| this.SetPaymentDirection(); | ||
| end; | ||
| } | ||
| field(2; "Payment No."; Integer) | ||
| { | ||
| Caption = 'Payment No.'; | ||
| AutoIncrement = true; | ||
| AllowInCustomizations = Always; | ||
| } | ||
| field(20; "Date"; Date) | ||
| { | ||
| Caption = 'Date'; | ||
| ToolTip = 'Specifies the value of the Date field.'; | ||
| } | ||
| field(21; Amount; Decimal) | ||
| { | ||
| Caption = 'Amount'; | ||
| DecimalPlaces = 2; | ||
| ToolTip = 'Specifies the value of the Amount field.'; | ||
|
|
||
| trigger OnValidate() | ||
| begin | ||
|
|
@@ -43,21 +52,31 @@ table 6101 "E-Document Payment" | |
| { | ||
| Caption = 'VAT Base'; | ||
| DecimalPlaces = 2; | ||
| Editable = false; | ||
| ToolTip = 'Specifies the value of the VAT Base field.'; | ||
|
||
| } | ||
| field(23; "VAT Amount"; Decimal) | ||
| { | ||
| Caption = 'VAT Amount'; | ||
| DecimalPlaces = 2; | ||
| Editable = false; | ||
| ToolTip = 'Specifies the value of the VAT Amount field.'; | ||
| } | ||
| field(24; Status; Enum "Payment Status") | ||
| { | ||
| Caption = 'Status'; | ||
| Editable = false; | ||
| InitValue = Created; | ||
| ToolTip = 'Specifies the value of the Status field.'; | ||
| } | ||
| field(25; Direction; Enum "E-Document Direction") | ||
| { | ||
| Caption = 'Direction'; | ||
| Editable = false; | ||
| ToolTip = 'Specifies the value of the Direction field.'; | ||
| } | ||
| } | ||
GMatuleviciute marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| keys | ||
| { | ||
| key(PK; "E-Document Entry No.", "Payment No.") | ||
|
|
@@ -66,12 +85,6 @@ table 6101 "E-Document Payment" | |
| } | ||
| } | ||
|
|
||
| trigger OnInsert() | ||
| begin | ||
| if Rec.Status = Rec.Status::" " then | ||
| Rec.Status := Rec.Status::Created; | ||
| end; | ||
|
|
||
| local procedure CalculateVAT() | ||
| var | ||
| EDocument: Record "E-Document"; | ||
|
|
@@ -86,4 +99,15 @@ table 6101 "E-Document Payment" | |
| Rec."VAT Base" := Rec.Amount / (EDocument."Amount Incl. VAT" / EDocument."Amount Excl. VAT"); | ||
| Rec."VAT Amount" := Rec.Amount - Rec."VAT Base"; | ||
| end; | ||
|
|
||
| local procedure SetPaymentDirection() | ||
| var | ||
| EDocument: Record "E-Document"; | ||
| begin | ||
| EDocument.Get(Rec."E-Document Entry No."); | ||
| if EDocument.Direction = EDocument.Direction::Outgoing then | ||
| Rec.Direction := Rec.Direction::Incoming | ||
| else | ||
| Rec.Direction := Rec.Direction::Outgoing; | ||
| end; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,41 +21,40 @@ page 6101 "E-Document Payments" | |
| field("Date"; Rec."Date") | ||
| { | ||
| ApplicationArea = All; | ||
|
||
| ToolTip = 'Specifies the value of the Date field.'; | ||
| Editable = this.PaymentEditable; | ||
| } | ||
| field(Amount; Rec.Amount) | ||
| { | ||
| ApplicationArea = All; | ||
| ToolTip = 'Specifies the value of the Amount field.'; | ||
| Editable = this.PaymentEditable; | ||
| } | ||
| field("VAT Base"; Rec."VAT Base") | ||
| { | ||
| ApplicationArea = All; | ||
| ToolTip = 'Specifies the value of the VAT Base field.'; | ||
| Visible = false; | ||
| } | ||
| field("VAT Amount"; Rec."VAT Amount") | ||
| { | ||
| ApplicationArea = All; | ||
| ToolTip = 'Specifies the value of the VAT Amount field.'; | ||
| Visible = false; | ||
| } | ||
| field(Status; Rec.Status) | ||
| { | ||
| ApplicationArea = All; | ||
| ToolTip = 'Specifies the value of the Status field.'; | ||
| } | ||
| field(Direction; Rec.Direction) | ||
| { | ||
| ApplicationArea = All; | ||
| ToolTip = 'Specifies the value of the Direction field.'; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| trigger OnNewRecord(BelowxRec: Boolean) | ||
| var | ||
| PaymentEditable: Boolean; | ||
|
|
||
| trigger OnAfterGetRecord() | ||
| begin | ||
| Evaluate(Rec.Direction, Rec.GetFilter("Direction")); | ||
| this.PaymentEditable := Rec.Status <> Rec.Status::Sent; | ||
| end; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.PaymentStatus := this.PaymentStatus::Paid; ( ; is missing)