Description
Method used to control the update processing of the financial information into the MFG/PRO database. This method must be implemented when utilizing the generic update infrastructure.
THIS MEANS THIS METHOD NEEDS TOP BE OVERRIDDEN IN THE DESCENDANT CLASS, NOT JUST EXTENDED
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program1/bmfgsystemaccountcontrol.p)
/* ================================================================================================ */
/* Build a comma delimited list of all the buffer handles for the MFG/PRO temp tables that need to */
/* be processed by the following process<type>ToMfg call. Ensure that the buffers are in the list */
/* in the sequence in which they need to be processed. */
/* Set the default return status to 'unexpected error' */
/* ================================================================================================ */
assign oiReturnStatus = -98
vcMfgBufferHandles = string(temp-table tgl_ctrl:handle:default-buffer-handle).
/* ================================================================================================ */
/* Execute the generic processing method that controls processing all of the shared set records and */
/* all domains linked to the shared set. */
/* If more than one financial table needs to be processed as part of this transaction then multiple */
/* calls to the process<type>ToMfg method can be made. */
/* ================================================================================================ */
<M-20 run ProcessSystemWideToMfg
(input temp-table tCopyDomainRef:handle:default-buffer-handle (ihFinancialDataBuffer),
input vcMfgBufferHandles (icMfgBufferHandleList),
output viFcReturnSuper (oiReturnStatus)) in BMfgSystemAccountControl>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then Return.
/* ======================== */
/* Set ReturnStatus = OK */
/* ======================== */
if oiReturnStatus = -98
then assign oiReturnStatus = 0.
/*
assign
viLocalReturnStatus = oiReturnStatus
oiReturnStatus = -98.
UPDATEFROMDOMAINS:
for each tCopyDomainRef
where tCopyDomainRef.tc_Status EQ 'C':U
or tCopyDomainRef.tc_Status EQ 'N':U:
if tCopyDomainRef.tc_Status EQ 'C':U then do:
assign vcFreeForm = subst("for each gl_ctrl where gl_domain = '&1'":U, tCopyDomainRef.DomainCode).
<M-4 run DataLoad (input '' (icRowids),
input '' (icPkeys),
input '' (icObjectIds),
input vcFreeForm (icFreeform),
input true (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BMfgSystemAccountControl>
assign viLocalReturnStatus = viFcReturnSuper
when (viFcReturnSuper > 0 and viLocalReturnStatus > 0)
or (viFcReturnSuper < 0 and viLocalReturnStatus > viFcReturnSuper).
end.
else do: /* tCopyDomainRef.tc_Status EQ 'N':U */
<M-10 run AddDetailLine
(input 'gl_ctrl':U (icTable),
input '' (icParentRowid),
output oiReturnStatus (oiReturnStatus)) in BMfgSystemAccountControl>
assign viLocalReturnStatus = viFcReturnSuper
when (viFcReturnSuper > 0 and viLocalReturnStatus > 0)
or (viFcReturnSuper < 0 and viLocalReturnStatus > viFcReturnSuper).
if viFcReturnSuper >= 0 then
assign
tgl_ctrl.gl_domain = tCopyDomainRef.DomainCode
tgl_ctrl.oid_gl_ctrl = <M-19 GetNextOidValue () in BMfgSystemAccountControl>.
end.
find tgl_ctrl where tgl_ctrl.gl_domain = tCopyDomainRef.DomainCode no-error.
if not available tgl_ctrl then do:
assign
vcMessageText = trim(#T-11'The system cannot find or create a GL Control record.':255(65562)t-11#)
viLocalReturnStatus = -3 when viLocalReturnStatus > -3
oiReturnStatus = viLocalReturnStatus.
<M-12 run SetMessage
(input vcMessageText (icMessage),
input '' (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'QadFin-7144':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMfgSystemAccountControl>
return.
end.
if tgl_ctrl.gl_lang <> tCopyDomainRef.tcLngCode then
assign
tgl_ctrl.gl_lang = tCopyDomainRef.tcLngCode
tgl_ctrl.tc_Status = 'C':U when tgl_ctrl.tc_Status <> 'N':U.
if tgl_ctrl.gl_entity <> tCopyDomainRef.tcCompanyCode then
assign
tgl_ctrl.gl_entity = tCopyDomainRef.tcCompanyCode
tgl_ctrl.tc_Status = 'C':U when tgl_ctrl.tc_Status <> 'N':U.
end.
UPDATEFROMDOMAINPROPERTY:
for each tCopyDomainPropertyRefC
where tCopyDomainPropertyRefC.tc_Status = "C":U
or tCopyDomainPropertyRefC.tc_Status = "N":U:
for first tCopyDomainRef
where tCopyDomainRef.Domain_ID = tCopyDomainPropertyRefC.Domain_ID:
if tCopyDomainPropertyRefC.tc_Status = "C":U then do:
assign vcFreeForm = subst("for each gl_ctrl where gl_domain = '&1'":U, tCopyDomainRef.DomainCode).
<M-2 run DataLoad (input '' (icRowids),
input '' (icPkeys),
input '' (icObjectIds),
input vcFreeForm (icFreeform),
input true (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BMfgSystemAccountControl>
assign viLocalReturnStatus = viFcReturnSuper
when (viFcReturnSuper > 0 and viLocalReturnStatus > 0)
or (viFcReturnSuper < 0 and viLocalReturnStatus > viFcReturnSuper).
end.
/* otherwise tCopyDomainPropertyRefC.tc_Status = "N":U
We don't need to handle this case as the tgl_ctrl should
already have been created in the UPDATEFROMDOMAINS loop above.
*/
find tgl_ctrl where tgl_ctrl.gl_domain = tCopyDomainRef.DomainCode no-error.
if not available tgl_ctrl then do:
assign
vcMessageText = trim(#T-14'The system cannot find or create a GL Control record.':255(65562)t-14#)
viLocalReturnStatus = -3 when viLocalReturnStatus > -3
oiReturnStatus = viLocalReturnStatus.
<M-13 run SetMessage
(input vcMessageText (icMessage),
input '' (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'QadFin-7147':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMfgSystemAccountControl>
return.
end.
if tgl_ctrl.gl_base_curr <> tCopyDomainPropertyRefC.tcCurrencyCode then
assign
tgl_ctrl.gl_base_curr = tCopyDomainPropertyRefC.tcCurrencyCode
tgl_ctrl.tc_Status = 'C':U.
<Q-8 run CurrencyByCurrRoundingMethod (all) (Read) (NoCache)
(input ?, (CurrencyID)
input tCopyDomainPropertyRefC.tcCurrencyCode, (CurrencyCode)
input ?, (RoundingMethodCode)
output dataset tqCurrencyByCurrRoundingMethod) in BCurrency >
find first tqCurrencyByCurrRoundingMethod no-error.
if not available tqCurrencyByCurrRoundingMethod then do:
assign
vcMessageText = trim(#T-18'The currency with the key $1 does not exist.':100(48939)t-18#)
viLocalReturnStatus = -3 when viLocalReturnStatus > -3
oiReturnStatus = viLocalReturnStatus.
<M-17 run SetMessage
(input vcMessageText (icMessage),
input tCopyDomainPropertyRefC.tcCurrencyCode (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'QadFin-7149':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMfgSystemAccountControl>
return.
end.
if tgl_ctrl.gl_rnd_mthd <> tqCurrencyByCurrRoundingMethod.tcRoundingMethodCode then
assign
tgl_ctrl.gl_rnd_mthd = tqCurrencyByCurrRoundingMethod.tcRoundingMethodCode
tgl_ctrl.tc_Status = 'C':U when tgl_ctrl.tc_Status <> 'N':U.
end.
end.
assign oiReturnStatus = viLocalReturnStatus.*/