...
In accounting with grouped history, the system makes an assessment as to which history it will use.
For this evaluation, the routine uses the MV_AGLHIST parameter (if it groups the histories ( default .F. )), if the parameter is set to .T., the routine will consider the history in the search rule, otherwise it will use the first history it finds.
Besides the history search rule, the routine evaluates the use of the grouped history. This evaluation is done based on the information that the user entered in the standard entry (CT5) in the grouped history fields. If this is empty, the routine groups the histories stored in the counterproof files (CTK); otherwise, it uses the value of the field (CT5), ignoring the histories in the counterproof file.
The rule for using the grouped histories is:
If !Empty(CT5->CT5_HAGLUT) /// AND THE GROUPED HISTORY IS FILLED IN#IFDEF IN
#IFDEF TOP /// if it is top connect
connect If TcSrvType() <> "AS/400" /// IN TOP ENVIRONMENT <> AS/400 400
If Empty(TMP->CT2_HIST) /// IF THE TMP HISTORY IS EMPTY
EMPTY lGravaHAglut := .T. /// BUILD GROUPED HISTORY
HISTORY lGravaHist := .T.
Else
Else /// IF THE TMP HISTORY IS FILLED IN
IN lGravaHAglut := .F. /// SAVE HISTORY CONTINUATIONS FROM CTK_HAGLUT/CTK_HIST (TOP)
lGravaHist := .T. EndIf Else #ENDIF
EndIf
Else
#ENDIF
If lCTKHAGLUT /// VERIFICATION VARIABLE FOR THE FIELD CTK_HAGLUT
HAGLUT lGravaHAglut := .F. /// DOES NOT USE THE HISTORY GROUPING GROUPING
lGravaHist := .T. /// USES THE REGULAR HISTORY HISTORY
Else /// OTHERWISE
OTHERWISE lGravaHAglut := .T. ///USES THE GROUPED HISTORY HISTORY
lGravaHist := .T. /// USES THE REGULAR HISTORY
EndIf
#IFDEF TOP
EndIf
HISTORY EndIf #IFDEF TOP EndIf #ENDIFElseIf lSomaLinha /// OTHERWISE 1ST RECORD GROUPING CODEBASE (TOP ALWAYS .T.)
lGravaHist := .T.
lGravaHAglut := .F.
EndIf
It EndIfIt is recommended that, when using the agglutinated history field, you do not use public fields or variables from the system, as in these cases, when recording, the field or variable may be not positioned or without content, thus not generating the desired information. Pay attention to the fact that, in a grouped accounting, it does not necessarily have to be positioned in the record.