Skip to content

Commit

Permalink
Merge pull request #45 from fluxxus-nl/Journal_Posting
Browse files Browse the repository at this point in the history
Journal posting
  • Loading branch information
lvanvugt authored Sep 20, 2024
2 parents 4d3815f + 0b7a8d4 commit 9af7981
Show file tree
Hide file tree
Showing 13 changed files with 255 additions and 30 deletions.
14 changes: 14 additions & 0 deletions app/src/codeunit/ConfRegShowLedger.Codeunit.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
codeunit 50006 "Conf. Reg.-Show Ledger ASD"
{
TableNo = "Conference Register ASD";

trigger OnRun()
begin
ConfLedgEntry.SetRange("Entry No.", Rec."From Entry No.", Rec."To Entry No.");
PAGE.Run(PAGE::"Conference Ledger Entries ASD", ConfLedgEntry);
end;

var
ConfLedgEntry: Record "Conference Ledger Entry ASD";
}

5 changes: 0 additions & 5 deletions app/src/codeunit/ConferenceJnlCheckLine.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,4 @@ codeunit 50000 "Conference Jnl.-Check Line ASD"
if LocalQty = 0 then
Error(QuantityNotEqualZeroErr);
end;

local procedure GetResource()
begin

end;
}
41 changes: 41 additions & 0 deletions app/src/codeunit/ConferenceJnlPostLine.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ codeunit 50001 "Conference Jnl.-Post Line ASD"
var
ConferenceJournalASD: Record "Conference Journal ASD";
ConferenceLineASD: Record "Conference Line ASD";
ConferenceRegister: Record "Conference Register ASD";

ConferenceJnlCheckLineASD: Codeunit "Conference Jnl.-Check Line ASD";
NextEntryNo: Integer;


trigger OnRun()
begin
Expand Down Expand Up @@ -49,6 +53,43 @@ codeunit 50001 "Conference Jnl.-Post Line ASD"
local procedure PostJournalToLedger(ConferenceJournalASD: Record "Conference Journal ASD")
var
ConferenceLedgerEntryASD: Record "Conference Ledger Entry ASD";
ConferenceASD: Record "Conference ASD";

begin
if NextEntryNo = 0 then begin
ConferenceLedgerEntryASD.LockTable();
NextEntryNo := ConferenceLedgerEntryASD.GetLastEntryNo() + 1;
end;

if ConferenceRegister."No." = 0 then begin
ConferenceRegister.LockTable();
if (not ConferenceRegister.FindLast()) or (ConferenceRegister."To Entry No." <> 0) then begin
ConferenceRegister.Init();
ConferenceRegister."No." := ConferenceRegister."No." + 1;
ConferenceRegister."From Entry No." := NextEntryNo;
ConferenceRegister."To Entry No." := NextEntryNo;
ConferenceRegister."Creation Date" := Today();
ConferenceRegister."Creation Time" := Time();
ConferenceRegister."Source Code" := ConferenceJournalASD."Source Code";
ConferenceRegister."Journal Batch Name" := ConferenceJournalASD."Journal Batch Name";
ConferenceRegister."User ID" := UserId();
ConferenceRegister.Insert();
end;
end;
ConferenceRegister."To Entry No." := NextEntryNo;
ConferenceRegister.Modify();

ConferenceASD.Get(ConferenceJournalASD."Document No.");
ConferenceASD.TestField(Blocked, false);

ConferenceLedgerEntryASD.Init();
ConferenceLedgerEntryASD.CopyFromConferenceJnlLine(ConferenceJournalASD);

ConferenceLedgerEntryASD."Total Price" := Round(ConferenceLedgerEntryASD."Total Price");
ConferenceLedgerEntryASD.Description := '';
ConferenceLedgerEntryASD."User ID" := UserId();
ConferenceLedgerEntryASD."Entry No." := NextEntryNo;
ConferenceLedgerEntryASD.Insert();
NextEntryNo := NextEntryNo + 1;
end;
}
4 changes: 4 additions & 0 deletions app/src/page/ConferenceCard.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ page 50003 "Conference Card ASD"
Editable = true;
ToolTip = 'Specifies the value of the Total Price field.', Comment = '%';
}
field(Blocked; Rec.Blocked)
{
ToolTip = 'Specifies the value of the Blocked field.', Comment = '%';
}
}

part(ConferenceRegistrationLines; "Conference Lines ASD")
Expand Down
118 changes: 118 additions & 0 deletions app/src/page/ConferenceLedgerEntries.Page.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
page 50020 "Conference Ledger Entries ASD"
{
ApplicationArea = Jobs;
Caption = 'Conference Ledger Entries';
DataCaptionFields = "Resource No.";
Editable = false;
PageType = List;
SourceTable = "Conference Ledger Entry ASD";
SourceTableView = Sorting("Description", "Posting Date") order(descending);

Check warning on line 9 in app/src/page/ConferenceLedgerEntries.Page.al

View workflow job for this annotation

GitHub Actions / Build . (Default) / . (Default)

AL0254 Sorting field 'Description' should be part of the keys for table 'Conference Ledger Entry ASD'

Check warning on line 9 in app/src/page/ConferenceLedgerEntries.Page.al

View workflow job for this annotation

GitHub Actions / Build . (Default) / . (Default)

AL0254 Sorting field 'Posting Date' should be part of the keys for table 'Conference Ledger Entry ASD'
UsageCategory = History;

layout
{
area(content)
{
repeater(Lists)
{
field("Entry Type"; Rec."Entry Type")
{
ToolTip = 'Specifies the value of the Entry Type field.';
}
field("Document No."; Rec."Document No.")
{
ToolTip = 'Specifies the value of the Document No. field.';
}
field("Journal Batch Name"; Rec."Journal Batch Name")
{
ToolTip = 'Specifies the value of the Journal Batch Name field.';
}
field("Resource No."; Rec."Resource No.")
{
ToolTip = 'Specifies the value of the Resource No. field.';
}
field("Source Code"; Rec."Source Code")
{
ToolTip = 'Specifies the value of the Source Code field.';
}
field("Unit Price"; Rec."Unit Price")
{
ToolTip = 'Specifies the value of the Unit Price field.';
}
field("Total Price"; Rec."Total Price")
{
ToolTip = 'Specifies the value of the Total Price field.';
}
field("Unit of Measure Code"; Rec."Unit of Measure Code")
{
ToolTip = 'Specifies the value of the Unit of Measure Code field.';
}
field("User ID"; Rec."User ID")
{
ToolTip = 'Specifies the value of the User ID field.';
}
field("Posting Date"; Rec."Posting Date")
{
ToolTip = 'Specifies the value of the Posting Date field.';
}
field(Description; Rec.Description)
{
ToolTip = 'Specifies the value of the Description field.';
}
field("Document Date"; Rec."Document Date")
{
ToolTip = 'Specifies the value of the Document Date field.';
}
field("Entry No."; Rec."Entry No.")
{
ToolTip = 'Specifies the value of the Entry No. field.';
}
field("Gen. Bus. Posting Group"; Rec."Gen. Bus. Posting Group")
{
ToolTip = 'Specifies the value of the Gen. Bus. Posting Group field.';
}
/*field("VAT. Bus. Posting Group"; Rec."VAT. Bus. Posting Group")
{
ToolTip = 'Specifies the value of the VAT. Bus. Posting Group field.';
}*/
}
}

area(factboxes)
{
systempart(Control1900383207; Links)
{
ApplicationArea = RecordLinks;
Visible = false;
}
systempart(Control1905767507; Notes)
{
ApplicationArea = Notes;
Visible = false;
}
}
}
actions
{
area(processing)
{
action("&Navigate")
{
ApplicationArea = Jobs;
Caption = 'Find entries...';
Image = Navigate;
ShortCutKey = 'Ctrl+Alt+Q';
ToolTip = 'Find entries and documents that exist for the document number and posting date on the selected document. (Formerly this action was named Navigate.)';

trigger OnAction()
begin
Navigate.SetDoc(Rec."Posting Date", Rec."Document No.");
Navigate.SetRec(Rec);
Navigate.Run();
end;
}
}
}
var
Navigate: Page Navigate;
}
27 changes: 8 additions & 19 deletions app/src/page/ConferenceRegisterList.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ page 50015 "Conference Register List ASD"
{

ApplicationArea = Jobs;
Caption = 'Resource Registers';
Caption = 'Conference Register';
Editable = false;
PageType = List;
SourceTable = "Resource Register";
SourceTable = "Conference Register ASD";
UsageCategory = History;

layout
Expand Down Expand Up @@ -87,34 +87,23 @@ page 50015 "Conference Register List ASD"
{
Caption = '&Register';
Image = Register;
action("Resource Ledger")
action("Conference Ledger")
{
ApplicationArea = Jobs;
Caption = 'Resource Ledger';
Image = ResourceLedger;
RunObject = Codeunit "Res. Reg.-Show Ledger";
ToolTip = 'View the ledger entries for the resource.';
Caption = 'Conference Ledger';
Image = Ledger;
RunObject = Codeunit "Conf. Reg.-Show Ledger ASD";
ToolTip = 'View the ledger entries for the Conference.';
}
}
}
area(processing)
{
action("Delete Empty Resource Registers")
{
ApplicationArea = All;
Caption = 'Delete Empty Resource Registers';
Image = Delete;
RunObject = Report "Delete Empty Res. Registers";
ToolTip = 'Find and delete empty resource registers.';
}
}
area(Promoted)
{
group(Category_Process)
{
Caption = 'Process';

actionref("Resource Ledger_Promoted"; "Resource Ledger")
actionref("Conference Ledger_Promoted"; "Conference Ledger")
{
}
}
Expand Down
13 changes: 11 additions & 2 deletions app/src/page/Conferencelocationcard.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,24 @@ page 50002 "Conference Location Card ASD"
{
action(CreateConferenceDocument)
{
Caption = 'Create Conference Document (TEST)';
Caption = 'Create Conference Document';
ToolTip = 'Specifies the Create Conference Document action';
ApplicationArea = All;
Scope = Repeater;
Image = Create;

trigger OnAction();
var
ConferenceASD: record "Conference ASD";
begin
Message('in progress');
if Rec."No." <> '' then begin
ConferenceASD.Init();
ConferenceASD.ConferenceLocation := Rec."No.";
if Rec."Unit Price" <> 0 then
ConferenceASD."Unit Price" := Rec."Unit Price";
ConferenceASD.Insert(true);
PAGE.Run(Page::"Conference Card ASD", ConferenceASD);
end;
end;
}
}
Expand Down
13 changes: 11 additions & 2 deletions app/src/page/Conferencelocationlist.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,24 @@ page 50000 "Conference Location List ASD"
{
action(CreateConferenceDocument)
{
Caption = 'Create Conference Document (TEST)';
Caption = 'Create Conference Document';
ToolTip = 'Specifies the Create Conference Document action';
ApplicationArea = All;
Scope = Repeater;
Image = Create;

trigger OnAction();
var
ConferenceASD: record "Conference ASD";
begin
Message('in progress');
if Rec."No." <> '' then begin
ConferenceASD.Init();
ConferenceASD.ConferenceLocation := Rec."No.";
if Rec."Unit Price" <> 0 then
ConferenceASD."Unit Price" := Rec."Unit Price";
ConferenceASD.Insert(true);
PAGE.Run(Page::"Conference Card ASD", ConferenceASD);
end;
end;
}
}
Expand Down
4 changes: 4 additions & 0 deletions app/src/page/PostedConferenceCard.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ page 50012 "Posted Conference Card ASD"
{
ToolTip = 'Specifies the value of the Total Price field.', Comment = '%';
}
field(Blocked; Rec.Blocked)
{
ToolTip = 'Specifies the value of the Blocked field.', Comment = '%';
}
}
group(Booking)
{
Expand Down
4 changes: 4 additions & 0 deletions app/src/table/Conference.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ table 50002 "Conference ASD"
"Total Price" := "Unit Price" * Duration / 3600000;
end;
}
field(20; Blocked; Boolean)
{
Caption = 'Blocked';
}
}

keys
Expand Down
34 changes: 34 additions & 0 deletions app/src/table/ConferenceLedgerEntry.Table.al
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ table 50010 "Conference Ledger Entry ASD"
Caption = 'No. Series';
TableRelation = "No. Series";
}
field(30; Quantity; decimal)
{
Caption = 'Quantity';
}
}

keys
Expand All @@ -107,4 +111,34 @@ table 50010 "Conference Ledger Entry ASD"
Clustered = true;
}
}

procedure GetLastEntryNo(): Integer;
var
FindRecordManagement: Codeunit "Find Record Management";
begin
exit(FindRecordManagement.GetLastEntryIntFieldValue(Rec, FieldNo("Entry No.")))
end;

procedure CopyFromConferenceJnlLine(ConferenceJournalASD: Record "Conference Journal ASD");
begin
Rec."Entry Type" := ConferenceJournalASD."Entry Type";
Rec."Document No." := ConferenceJournalASD."Document No.";
Rec."Posting Date" := ConferenceJournalASD."Posting Date";
Rec."Document Date" := ConferenceJournalASD."Document Date";
//document no duplicate insert removed
Rec.Description := ConferenceJournalASD.Description;
Rec.Quantity := ConferenceJournalASD.Quantity;
Rec."Unit Price" := ConferenceJournalASD."Unit Price";
Rec."Total Price" := ConferenceJournalASD."Total Price";
//Rec."Starting Date" := ConferenceJournalASD."Starting Date";
//Rec."Resource Ledger Entry No." := ConferenceJournalASD."Resource Ledger Entry No.";
Rec."Source Code" := ConferenceJournalASD."Source Code";
Rec."Journal Batch Name" := ConferenceJournalASD."Journal Batch Name";
Rec."Reason Code" := ConferenceJournalASD."Reason Code";
// ASD8.03<
//Rec."Global Dimension 1 Code" := ConferenceJournalASD."Shortcut Dimension 1 Code";
//Rec."Global Dimension 2 Code" := ConferenceJournalASD."Shortcut Dimension 2 Code";
//Rec."Dimension Set ID" := ConferenceJournalASD."Dimension Set ID";
// ASD8.03>
end;
}
Loading

0 comments on commit 9af7981

Please sign in to comment.