Usina BRAdvPL Guide
Sign in
← All topics
ENTRY POINTUnder review

F060CPM

F060CPM()

Handles average term calculation in FINA060/FINA061. An independent weighted average example and criteria for validating integration.

F060CPMFINA060FINA061
01 · OVERVIEW

Overview

The official Financeiro P12 index associates F060CPM with FINA060/FINA061 for average term calculation; its specific page remains under construction. (TOTVS, n.d., ref. 1) Functional documentation places these routines in collection batch generation and maintenance, including API transmission options. (TOTVS, 2023, ref. 2) That context does not establish when the entry point runs or what it receives. F060CPM() identifies the entry point; the full call, PARAMIXB format and return value were not confirmed in the public sources located. The following example is an independent editorial exercise showing a possible value-weighted average, without asserting that it is the Protheus formula. Content is under review, based on indexed evidence with restricted full documentation access.

02 · SYNTAX

Syntax

F060CPM()

Parameters

Entry point context
UndocumentedContext to confirm

Arguments and execution context are unconfirmed. Do not assume that PARAMIXB contains an array of receivables, amounts or due dates; the example structure was created solely for the exercise.

Return value

The entry point return type, unit and use are unconfirmed. The example does not implement F060CPM or define the return required by its caller.

03 · PRACTICAL EXAMPLE

Check a weighted average hypothesis outside the entry point

#Include "Protheus.ch"

User Function ExF060CPM()
    Local aCases := {{1000, 30}, {3000, 60}}
    Local nIndex := 0
    Local nTotalAmount := 0
    Local nWeightedTotal := 0
    Local nAverageTerm := Nil

    // Each authored row contains {fictional amount, term in days}.
    // This format represents neither PARAMIXB nor the standard formula.
    For nIndex := 1 To Len(aCases)
        nTotalAmount += aCases[nIndex][1]
        nWeightedTotal += aCases[nIndex][1] * aCases[nIndex][2]
    Next nIndex

    // Without a positive base, zero is not treated as a calculated term.
    If nTotalAmount > 0
        nAverageTerm := nWeightedTotal / nTotalAmount
        ConOut("Exercise average term: " + AllTrim(Str(nAverageTerm, 10, 2)))
    EndIf
Return
Expected result

The fictional dataset yields 52.5 days: (1000 × 30 + 3000 × 60) ÷ 4000. The simple average would be 45 days; the difference helps identify distinct weighting assumptions. The example uses no real dates, writes no collection batch and has not been compiled or run in Protheus.

BEST PRACTICES
  • Before customizing, confirm the formula and entry point contract in the target release. Establish whether the weight uses original amount, balance or another amount.
  • Agree on the reference date, overdue handling, calendar and rounding with process owners. The entry point name does not confirm these criteria.
  • Compare one selection with equal amounts and another with different amounts. Retain standard results and the expected calculation breakdown.
  • Test empty selection, zero-value receivables and rounding cases for combinations actually accepted in the environment.
  • Validate FINA060 and FINA061 separately; listing both routines does not establish identical contracts.
COMMON PITFALLS
  • Confusing simple and weighted averages and obtaining correct results only when amounts happen to match.
  • Treating the exercise array as the official PARAMIXB structure.
  • Mixing currencies or amount bases without an explicit normalization rule.
  • Returning Nil, zero or a number of days without confirming caller expectations.

Related content

REFERENCES
  1. TOTVS. Pontos de Entrada - Financeiro - P12. TDN. Indexed evidence consulted on 2026-10-20.
  2. TOTVS. Transferência e Manutenção de Borderô - FINA060 / FINA061. TDN. 6 jan. 2023. Indexed evidence accessed on 2026-10-20.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha