KVSKBAMasterDocGlobalData#
Procedures#
InitDocumentLineValues() : Integer#
Summary: Initializes all document line values and counters to their default state.
procedure InitDocumentLineValues(): Integer
Returns: Always returns 0.
Remarks: Call this procedure at the beginning of document processing to reset all state variables. This includes page/block triggers, subtotal levels, carry amounts, and copy loop counters. Also loads company information and sales setup if not already loaded.
GetNextDocOrderNo() : Integer#
Summary: Retrieves and increments the document order number.
procedure GetNextDocOrderNo(): Integer
Returns: The next document order number.
Remarks: Used to assign sequential order numbers to documents in the print queue. The counter is incremented with each call.
GetNextDataItemEntryNo() : Integer#
Summary: Retrieves and increments the data item entry number.
procedure GetNextDataItemEntryNo(): Integer
Returns: The next data item entry number.
Remarks: Used to assign unique entry numbers to data items in the document buffer. The counter is incremented by 10 with each call to allow for intermediate insertions.
ForceNewPage() :#
Summary: Forces a page break at the current position.
procedure ForceNewPage():
Parameters:
- ``````:
LineNo: The current line number.
Remarks: Increments the page trigger counter to signal that a new page should start. The layout engine will honor this trigger when rendering the document.
GetNewPageTrigger() : Integer#
Summary: Retrieves the current page break trigger value.
procedure GetNewPageTrigger(): Integer
Returns: The current page trigger counter.
Remarks: The layout engine uses this value to determine when page breaks should occur. Each increment represents a requested page break.
ForceNewPage2(Integer) :#
Summary: Forces a page break only when the line number changes.
procedure ForceNewPage2(LineNo: Integer):
Parameters:
LineNo: The current line number.
Remarks: This ensures that document lines stay together on the same page. A page break is only triggered when transitioning to a different line number. Useful for keeping related line information (description, amounts, etc.) together.
ForceNewLineBlock(Boolean, Integer, Enum KVSKBADocumentLineType) :#
Summary: Forces a line block break based on configuration and line type.
procedure ForceNewLineBlock(PrintNewLineBlock: Boolean; LineNo: Integer; LineType: Enum "KVSKBADocumentLineType"):
Parameters:
PrintNewLineBlock: Whether to force a new block regardless of line number.LineNo: The current line number.LineType: The type of document line.
Remarks: Line blocks are visual groupings of lines in the document layout. Behavior depends on the KVSKBADocLineBlockSeparator setting in Company Information. Comment lines are not considered for automatic block breaks.
ForceNewLineBlock2(Integer) :#
Summary: Forces a line block break only when the line number changes.
procedure ForceNewLineBlock2(LineNo: Integer):
Parameters:
LineNo: The current line number.
Remarks: Similar to ForceNewPage2 but for line blocks instead of page breaks. Only triggers a new block when transitioning to a different line number. Respects the KVSKBADocLineBlockSeparator setting in Company Information.
GetNewLineBlockTrigger() : Integer#
Summary: Retrieves the current line block trigger value.
procedure GetNewLineBlockTrigger(): Integer
Returns: The current line block trigger counter.
Remarks: The layout engine uses this value to determine when line block breaks should occur. Each increment represents a requested line block break.
SetCopyLoopNo(Integer) :#
Summary: Sets the current copy loop number for multi-copy printing.
procedure SetCopyLoopNo(LoopNo: Integer):
Parameters:
LoopNo: The copy loop number to set (1-based).
Remarks: Used when printing multiple copies of a document. The copy number can be displayed on the document (e.g., "Copy 2 of 3").
GetCopyLoopNo() : Integer#
Summary: Retrieves the current copy loop number.
procedure GetCopyLoopNo(): Integer
Returns: The current copy loop number.
Remarks: Returns the copy number that is currently being processed. Default value is 1 if not explicitly set.
InitVATTotals() :#
Summary: Initializes all VAT total accumulation values to zero.
procedure InitVATTotals():
Remarks: Call this before processing VAT lines to reset the running totals. This ensures accurate VAT calculations for each document. Resets VAT base, amount, line amount, invoice discount base, and invoice discount amount.
UpdateVATBase(Decimal) : Decimal#
Summary: Adds an amount to the VAT base total and returns the new total.
procedure UpdateVATBase(Amount: Decimal): Decimal
Parameters:
Amount: The amount to add to the VAT base.
Returns: The updated VAT base total.
Remarks: Used to accumulate the total VAT base amount across all VAT lines. The running total is maintained internally for summary calculations.
UpdateVATAmount(Decimal) : Decimal#
Summary: Adds an amount to the VAT amount total and returns the new total.
procedure UpdateVATAmount(Amount: Decimal): Decimal
Parameters:
Amount: The amount to add to the VAT amount.
Returns: The updated VAT amount total.
Remarks: Used to accumulate the total VAT amount across all VAT lines. The running total is maintained internally for summary calculations.
UpdateVATLineAmount(Decimal) : Decimal#
Summary: Adds an amount to the VAT line amount total and returns the new total.
procedure UpdateVATLineAmount(Amount: Decimal): Decimal
Parameters:
Amount: The amount to add to the VAT line amount.
Returns: The updated VAT line amount total.
Remarks: Used to accumulate the total line amount subject to VAT across all VAT lines. The running total is maintained internally for summary calculations.
UpdateVATInvDiscBaseAmount(Decimal) : Decimal#
Summary: Adds an amount to the VAT invoice discount base amount total and returns the new total.
procedure UpdateVATInvDiscBaseAmount(Amount: Decimal): Decimal
Parameters:
Amount: The amount to add to the invoice discount base.
Returns: The updated VAT invoice discount base total.
Remarks: Used to accumulate the total invoice discount base amount across all VAT lines. The running total is maintained internally for summary calculations.
UpdateVATInvDiscAmount(Decimal) : Decimal#
Summary: Adds an amount to the VAT invoice discount amount total and returns the new total.
procedure UpdateVATInvDiscAmount(Amount: Decimal): Decimal
Parameters:
Amount: The amount to add to the invoice discount amount.
Returns: The updated VAT invoice discount amount total.
Remarks: Used to accumulate the total invoice discount amount across all VAT lines. The running total is maintained internally for summary calculations.
GetSubtotalLevel() : Integer#
Summary: Retrieves the current subtotal nesting level.
procedure GetSubtotalLevel(): Integer
Returns: The current subtotal level (0-based, max 10 levels).
Remarks: Subtotal levels are used for hierarchical document structures (e.g., bundles within bundles). Level 0 means no active subtotal grouping. Maximum supported level is 9 (array size 10).
IsCurrentSubtotaBundle() : Boolean#
Summary: Checks if the current subtotal level represents a bundle.
procedure IsCurrentSubtotaBundle(): Boolean
Returns: True if the current level is a bundle, false otherwise.
Remarks: Bundles are special subtotal groups that may have different display rules. The KVSKBAPrintPricesDetailBundle setting affects bundle behavior. Returns false if no subtotal level is active.
IncSubtotalLevel(Boolean) :#
Summary: Increments the subtotal nesting level and initializes totals for the new level.
procedure IncSubtotalLevel(IsBundle: Boolean):
Parameters:
IsBundle: True if this level represents a bundle, false for regular subtotal.
Remarks: Call this when starting a new subtotal group (e.g., bundle header). Raises an error if the maximum nesting level (10) is exceeded. The KVSKBAPrintPricesDetailBundle setting affects how bundles are treated. Each level maintains its own subtotal, alternative subtotal, and carry amount.
CloseSubtotalLevel(Decimal, Decimal, Text) :#
Summary: Closes the current subtotal level and returns accumulated totals.
procedure CloseSubtotalLevel(var CarryAmount: Decimal; var SubTotal: Decimal; LineInfo: Text):
Parameters:
CarryAmount: Output: The carry amount for the closed level.SubTotal: Output: The subtotal for the closed level.LineInfo: Information about the line for error messages.
Remarks: Call this when ending a subtotal group (e.g., bundle footer). Raises an error if called without a corresponding IncSubtotalLevel. The closed level's totals are added to the parent level (if any). For bundle levels, the subtotal may be zeroed depending on configuration.
GetSubtotalAlternative() : Decimal#
Summary: Retrieves the alternative subtotal for the current closed level.
procedure GetSubtotalAlternative(): Decimal
Returns: The alternative subtotal amount.
Remarks: Alternative subtotals are used for secondary pricing schemes or calculations. This value is set during CloseSubtotalLevel and represents the last closed level's alternative total.
AddSubtotalAmount(Decimal) :#
Summary: Adds a line amount to the current subtotal level.
procedure AddSubtotalAmount(LineAmount: Decimal):
Parameters:
LineAmount: The line amount to add.
Remarks: Accumulates the amount in both the subtotal and carry amount for the current level. Only affects the current level; parent levels are updated when the level is closed. Has no effect if no subtotal level is active (level 0).
AddSubtotalAlternativeAmount(Decimal) :#
Summary: Adds an alternative line amount to the current subtotal level.
procedure AddSubtotalAlternativeAmount(LineAmount: Decimal):
Parameters:
LineAmount: The alternative line amount to add.
Remarks: Used for secondary pricing schemes or alternative calculations. Only affects the alternative subtotal, not the regular subtotal or carry amount. Has no effect if no subtotal level is active (level 0).
SetPrintCarryAmount(Boolean) :#
Summary: Sets whether carry amounts should be printed on the document.
procedure SetPrintCarryAmount(Print: Boolean):
Parameters:
Print: True to enable carry amount printing, false to disable.
Remarks: Carry amounts show running totals that continue from page to page. This setting is typically controlled by the KVSKBAPrintCarryAmount field in Company Information.
PrintCarryAmount() : Boolean#
Summary: Checks whether carry amounts should be printed on the document.
procedure PrintCarryAmount(): Boolean
Returns: True if carry amounts should be printed, false otherwise.
Remarks: Returns the value set by SetPrintCarryAmount. Default value is false.