Entry point contextArguments 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.
AdvPL GuideF060CPM()Handles average term calculation in FINA060/FINA061. An independent weighted average example and criteria for validating integration.
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.
F060CPM()Entry point contextArguments 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.
The entry point return type, unit and use are unconfirmed. The example does not implement F060CPM or define the return required by its caller.
#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
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.
© 2026 Usina.BR. All rights reserved. TOTVS, Protheus, Microsiga and their respective logos are trademarks of their owners. AdvPL Guide is independent and uses limited, attributed excerpts justified by educational purposes. See the Terms of Use. Terms of Use
Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.