project QadFinancials > class BDomain > method SetStatutoryCurrency
Description
This method will make it possible to set the statutory currency for a certain domain and assign all the SC amounts for that domain.
Parameters
icDomainCode | input | character | |
icNewSCCode | input | character | |
ilDomainIsStatutoryCurrency | input | logical | |
ilPerformUpdatesAnyway | input | logical | |
oiDurationInSeconds | output | integer | |
ocDurationInText | output | character | |
oiPostingLineCounter | output | integer | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program6/bdomain.p)
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
STATUTORYBLOCK:
do:
/* =========================================================== */
/* Set statutory currency by running method in technical class */
/* =========================================================== */
assign vhFcComponent = ?.
<M-1 run SetStatutoryCurrency
(input icDomainCode (icDomainCode),
input icNewSCCode (icNewSCCode),
input ilDomainIsStatutoryCurrency (ilDomainIsStatutoryCurrency),
input ilPerformUpdatesAnyway (ilPerformUpdatesAnyway),
output vcErrorMessage (ocErrorMessage),
output oiDurationInSeconds (oiDurationInSeconds),
output ocDurationInText (ocDurationInText),
output oiPostingLineCounter (ogPostingLineCounter),
output vlTransactionsDone (olTransactionsDone),
output viFcReturnSuper (oiReturnStatus)) in TSetStatutoryCurrency>
if viFcReturnSuper <> 0
then assign viLocalReturnStatus = viFcReturnSuper.
run gipr_DeleteProcedure in vhFcComponent.
delete procedure vhFcComponent.
assign vhFcComponent = ?.
if viFcReturnSuper = 0 then
do:
/* Check version of operational code */
<M-31 run StartCacher
(output vhFcComponent (ohCacher),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
<M-81 run GetIntegerValueFromSession
(input viSessionID (iiSessionId),
input 'MfgProMajorVersion' (icDataItemName),
output viMfgProMajorVersion (oiValue),
output viFcReturnSuper (oiReturnStatus)) in Cacher>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
<M-23 run GetIntegerValueFromSession
(input viSessionID (iiSessionId),
input 'MfgProMinorVersion' (icDataItemName),
output viMfgProMinorVersion (oiValue),
output viFcReturnSuper (oiReturnStatus)) in Cacher>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
if viMfgProMajorVersion > 3 /* Meaning eB3 */ or
(viMfgProMajorVersion = 3 /* Meaning eB3 */ and
viMfgProMinorVersion >= 14 /* Meaning SP14 */)
then do:
empty temp-table tDomainsForFACtrl.
create tDomainsForFACtrl.
assign tDomainsForFACtrl.tcDomainCode = icDomainCode
tDomainsForFACtrl.tlIsFAEnabled = no
vhIn = dataset tDomainsForFACtrl:handle
vhFcComponent = ?.
<M-24 run SetFAFlagInControl
(input vhIn (izDomains),
output viFcReturnSuper (oiReturnStatus)) in PMfgProFACtrl>
if viFcReturnSuper <> 0 then
do:
/* IF Updating flag fails, it will no block the other transactions.*/
assign vcErrorMessage = trim( #T-14'An unexpected warning/error occured during update fixed asset control.':255(668287736)T-14#).
<M-32 run SetMessage
(input vcErrorMessage (icMessage),
input ? (icArguments),
input ? (icFieldName),
input ? (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input ? (icRowid),
input 'qadfin-847189':U (icFcMsgNumber),
input ? (icFcExplanation),
input ? (icFcIdentification),
input ? (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
end. /* end if viFcReturnSuper <> 0 */
end. /* end if viMfgProMajorVersion > 3 */
end. /* end if viFcReturnSuper = 0 */
if viLocalReturnStatus > 0
then do:
if vcErrorMessage = '':U or vcErrorMessage = ?
then assign vcErrorMessage = trim(#T-8'An unexpected warning occured during re-assigning the Statutory Currency Amounts. No further details available.':255(591292242)T-8#).
else assign vcErrorMessage = vcErrorMessage + chr(10) + trim(substitute(#T-9'Detailed error-identification number: &1.':255(733738695)T-9#,string(viLocalReturnStatus))).
<M-7 run SetMessage
(input vcErrorMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'W':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-9588':U:U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
end. /* if viLocalReturnStatus > 0 */
if viLocalReturnStatus < 0
then do:
if vcErrorMessage = '':U or vcErrorMessage = ?
then assign vcErrorMessage = trim(#T-6'An unexpected error occured during re-assigning the Statutory Currency Amounts. No further details available.':255(73476909)T-6#).
else assign vcErrorMessage = vcErrorMessage + chr(10) + trim(substitute(#T-10'Detailed error-identification number: &1.':255(733738695)T-10#,string(viLocalReturnStatus))).
<M-2 run SetMessage
(input vcErrorMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-9471':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
/* ============================================================================================ */
/* Warn the user that only part of the transactions has been done and that it needs to be rerun */
/* ============================================================================================ */
if vlTransactionsDone = true
then do:
assign vcMessage = trim(#T-5'Not all transactions were successfully processed. Make sure to correct the error and re-run the program to prevent database corruptions.':255(332072427)T-5#).
<M-3 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-9472':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDomain>
end. /* if vlTransactionsDone = true */
end. /* if viLocalReturnStatus <> 0 */
end. /* STATUTORYBLOCK */
assign oiReturnStatus = viLocalReturnStatus.