mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-10-05 14:46:55 +01:00
Contributed by CURABIS ApS, generalized from patterns observed across real AppSource/PTE development. Each article follows the knowledge file format (frontmatter, Description/Best Practice/Anti Pattern, sibling .good.al/.bad.al samples).
22 lines
719 B
AL
22 lines
719 B
AL
codeunit 50101 "Meter Jnl.-Post"
|
|
{
|
|
procedure Post(var MeterJnlLine: Record "Meter Journal Line")
|
|
var
|
|
MeterLedgEntry: Record "Meter Ledger Entry";
|
|
begin
|
|
// Validation, Journal access, and posting all mixed in one routine.
|
|
if not Confirm('Post journal lines?') then
|
|
exit;
|
|
|
|
if MeterJnlLine.FindSet() then
|
|
repeat
|
|
if MeterJnlLine.Quantity = 0 then
|
|
Error('Quantity must not be zero.');
|
|
|
|
MeterLedgEntry.Init();
|
|
MeterLedgEntry.TransferFields(MeterJnlLine);
|
|
MeterLedgEntry.Insert();
|
|
MeterJnlLine.Delete();
|
|
until MeterJnlLine.Next() = 0;
|
|
end;
|
|
}
|