Description
ApiGetJournalEntriesValidate: this method is a submethod of ApiGetJournalEntries and is thus named 'Api' although this method is no api-method
Parameters
icTransientLayerCode | input | character | |
icJournalCode | input | character | |
iiPeriodYearFrom | input | integer | |
iiPeriodPeriodFrom | input | integer | |
iiPeriodYearTo | input | integer | |
iiPeriodPeriodTo | input | integer | |
itDateFrom | input | date | |
itDateTo | input | date | |
icDescription | input | character | |
icTargetJournalCode | input | character | |
oiTransientLayerId | output | integer | |
oiJournalId | output | integer | |
oiYearPeriodFrom | output | integer | |
oiYearPeriodTo | output | integer | |
oiTargetJournalId | output | integer | |
ocTargetJournalTypeCode | output | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bmasslayertransfer.p)
/* =========================================================================== */
/* This method validates input parameters used for retrieving of journal */
/* for mass layer transfer */
/* =========================================================================== */
assign oiReturnStatus = -98.
/* ================================================================================================================ */
/* Check if PC is enabled for the current domain in case the activity is 'PC-Transfer' */
/* If so and the Final-daybook in the control-file is filled then the target journal should match the Final-daybook */
/* ================================================================================================================ */
if vcActivityCode = "PC-Transfer":U
then do :
if vlPeriodicCostingModuleIsActive = ? or
vcPeriodicCostingFinalJournal = ?
then do :
<M-45 run PeriodicCostingModuleIsActive
(input vcDomainCode (icDomainCode),
output vlPeriodicCostingModuleIsActive (olPeriodicCostingModuleIsActive),
output vcPeriodicCostingFinalJournal (ocPeriodicCostingFinalJournal),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end. /* if vlPeriodicCostingModuleIsActive = ? */
if vlPeriodicCostingModuleIsActive <> true
then do :
assign vcMessage = trim(substitute(#T-65'You cannot use activty &1 as the current domain (&2) is not enabled for Periodic-Costing.':255(402147668)T-65#, vcActivityCode, vcDomainCode)).
<M-72 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-244670':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end. /* if vlPeriodicCostingModuleIsActive = false */
if vcPeriodicCostingFinalJournal <> "":U and
vcPeriodicCostingFinalJournal <> ? and
vcPeriodicCostingFinalJournal <> icTargetJournalCode
then do :
assign oiReturnStatus = -1
vcMessage = trim(substitute(#T-77'The target daybook (&1) should match the final-daybook (&2) as specified in the periodic-costing control-file.':255(67004539)T-77#,icTargetJournalCode,vcPeriodicCostingFinalJournal)).
<M-84 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-685140':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
Return.
end. /* if vcPeriodicCostingFinalJournal <> "":U and */
end. /* if vcActivityCode = "PC-Transfer":U */
/* =============== */
/* Transient layer */
/* =============== */
assign oiTransientLayerId = ?.
/* Optional, if entered has to exists and has to be really transient layer */
if icTransientLayerCode <> ?
then do:
<Q-1 run LayerByCodeTypeCode (all) (Read) (NoCache)
(input ?, (LayerTypeCode)
input icTransientLayerCode, (LayerCode)
output dataset tqLayerByCodeTypeCode) in BLayer >
find first tqLayerByCodeTypeCode where
tqLayerByCodeTypeCode.tcLayerCode = icTransientLayerCode
no-error.
/* is entered layer code valid? */
if not available tqLayerByCodeTypeCode
then do:
assign vcMessage = #T-7'The transient layer code specified is not defined in the system.':200(998717269)T-7#.
<M-6 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'Transient Layer':U (icFieldName),
input icTransientLayerCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-4748':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end.
/* is entered layer transient? */
if tqLayerByCodeTypeCode.tcLayerTypeCode <> {&LAYERTYPECODE-TRANSIENT}
then do:
assign vcMessage = #T-5'You can only select a transient layer.':200(519404091)T-5#.
<M-4 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'Transient Layer':U (icFieldName),
input icTransientLayerCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-4747':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end.
assign oiTransientLayerId = tqLayerByCodeTypeCode.tiLayer_ID.
end.
/* =============== */
/* Journal */
/* =============== */
assign oiJournalId = ?
vcJournalTypeCode = ?.
/* optional, if entered is valid? */
if icJournalCode <> ?
then do:
<Q-11 run JournalByJournalLayerType (all) (Read) (NoCache)
(input ?, (JournalId)
input icJournalCode, (JournalCode)
input viCompanyId, (CompanyId)
input ?, (LayerTypeCode)
output dataset tqJournalByJournalLayerType) in BJournal >
find first tqJournalByJournalLayerType no-error.
/* is entered journal valid */
if not available tqJournalByJournalLayerType
then do:
assign vcMessage = #T-10'The daybook code is invalid.':200(117798065)T-10#.
<M-9 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'Journal':U (icFieldName),
input icJournalCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-4750':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end.
/* is entered journal of the layer already selected? */
if oiTransientLayerId <> ? and
oiTransientLayerId <> tqJournalByJournalLayerType.tiLayer_ID
then do:
assign vcMessage = #T-43'The selected daybook does not belong to transient layer &1.':200(693631956)T-43#
vcMessage = trim(substitute(vcMessage, icTransientLayerCode)).
<M-42 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'Journal':U (icFieldName),
input icJournalCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-4863':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end.
/* belongs entered journal to transient layer */
if tqJournalByJournalLayerType.tcLayerTypeCode <> {&LAYERTYPECODE-TRANSIENT}
then do:
assign vcMessage = #T-13'The daybook does you specified does not belong to the transient layer.':200(188956880)T-13#.
<M-12 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'Journal':U (icFieldName),
input icJournalCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-4751':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end.
/* Is the journal-type correct comparing to the activity ? */
assign vcMessage = "":U.
if vcActivityCode <> "PC-Transfer":U and
tqJournalByJournalLayerType.tcJournalTypeCode = {&JOURNALTYPE-PERIODICCOSTING}
then assign vcMessage = trim(substitute(#T-49'The daybook-code (&1) cannot have daybook-type &2 as you started activity &3.':255(52815618)T-49#,icTargetJournalCode,{&JOURNALTYPE-PERIODICCOSTING-TR},vcActivityCode)).
else if vcActivityCode = "PC-Transfer":U and
tqJournalByJournalLayerType.tcJournalTypeCode <> {&JOURNALTYPE-PERIODICCOSTING}
then assign vcMessage = trim(substitute(#T-50'The daybook-code (&1) should have daybook-type &2 as you started activity &3.':255(606045963)T-50#,icTargetJournalCode,{&JOURNALTYPE-PERIODICCOSTING-TR},vcActivityCode)).
if vcMessage <> "":U
then do :
<M-48 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-9817':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end. /* if vcMessage <> "":U */
assign oiJournalId = tqJournalByJournalLayerType.tiJournal_ID
vcJournalTypeCode = tqJournalByJournalLayerType.tcJournalTypeCode.
end.
/* ====================== */
/* Accounting Period From */
/* ====================== */
assign oiYearPeriodFrom = ?.
/* is mandatory */
if iiPeriodYearFrom = ? or
iiPeriodPeriodFrom = ?
then do:
assign vcMessage = #T-15'Parameter from GL period is mandatory.':200(31279)T-15#.
<M-14 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-4752':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end.
/* has to be defined in system */
<Q-16 run PeriodByYearPeriod (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input iiPeriodYearFrom, (PeriodYear)
input iiPeriodPeriodFrom, (PeriodPeriod)
input ?, (PeriodId)
output dataset tqPeriodByYearPeriod) in BPeriod >
find first tqPeriodByYearPeriod no-error.
if not available tqPeriodByYearPeriod
then do:
assign vcMessage = #T-18'Parameter from GL period is invalid.':200(31280)T-18#.
<M-17 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-4758':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end.
/* has to be open period */
if tqPeriodByYearPeriod.tcPeriodStatus <> {&PERIODSTATUS-OPEN}
then do:
assign vcMessage = (#T-21'The GL period &1/&2 is not open. You can only transfer journal entries in an open GL period.':200(482067748)T-21#)
vcMessage = trim(substitute(vcMessage,
iiPeriodYearFrom,
iiPeriodPeriodFrom)).
<M-20 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-4759':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end.
assign oiYearPeriodFrom = iiPeriodYearFrom * 100 + iiPeriodPeriodFrom.
/* ====================== */
/* Accounting Period To */
/* ====================== */
assign oiYearPeriodTo = ?.
/* is mandatory */
if iiPeriodYearTo = ? or
iiPeriodPeriodTo = ?
then do:
assign vcMessage = #T-26'You must complete the To GL period field':200(31284)T-26#.
<M-22 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-4760':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end.
/* has to be defined in system */
<Q-23 run PeriodByYearPeriod (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input iiPeriodYearTo, (PeriodYear)
input iiPeriodPeriodTo, (PeriodPeriod)
input ?, (PeriodId)
output dataset tqPeriodByYearPeriod) in BPeriod >
find first tqPeriodByYearPeriod no-error.
if not available tqPeriodByYearPeriod
then do:
assign vcMessage = #T-27'The To GL period value is invalid.':200(31283)T-27#.
<M-24 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-4761':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end.
/* has to be open period */
if tqPeriodByYearPeriod.tcPeriodStatus <> {&PERIODSTATUS-OPEN}
then do:
assign vcMessage = trim(substitute(#T-28'The GL period &1/&2 is not open. You can only transfer journal entries in an open GL period.':200(325560977)T-28#,
iiPeriodYearTo,
iiPeriodPeriodTo)).
<M-25 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-4762':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end.
assign oiYearPeriodTo = iiPeriodYearTo * 100 + iiPeriodPeriodTo.
/* check time consequence of these periods */
if oiYearPeriodFrom > oiYearPeriodTo
then do:
assign vcMessage = trim(#T-30'The GL periods were not entered chronologically.':200(925784358)T-30#).
<M-29 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-4763':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end.
/* ================ */
/* Posting dates */
/* ================ */
if itDateFrom <> ? and
itDateTo <> ? and
itDateFrom > itDateTo
then do:
assign vcMessage = trim(#T-32'The posting dates are not entered chronologically.':200(356553669)T-32#).
<M-31 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-4764':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end.
/* ======================= */
/* Target journal */
/* ======================= */
assign oiTargetJournalId = ?
ocTargetJournalTypeCode = ?.
/* mandatory */
if icTargetJournalCode = ?
then do:
assign vcMessage = trim(#T-34'You must enter a target daybook.':200(957907170)T-34#).
<M-33 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-4765':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end.
/* is valid ? */
<Q-35 run JournalByJournalLayerType (all) (Read) (NoCache)
(input ?, (JournalId)
input icTargetJournalCode, (JournalCode)
input viCompanyId, (CompanyId)
input ?, (LayerTypeCode)
output dataset tqJournalByJournalLayerType) in BJournal >
find first tqJournalByJournalLayerType no-error.
if not available tqJournalByJournalLayerType
then do:
assign vcMessage = trim(#T-37'The target daybook is invalid.':200(472271126)T-37#).
<M-36 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-4766':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end.
/* is active ? */
if tqJournalByJournalLayerType.tlJournalIsActive <> yes
then do:
assign vcMessage = trim(#T-39'The target daybook is no longer active.':200(194306045)T-39#).
<M-38 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-4767':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end.
/* Is the target journal-type correct comparing to the activity ? */
assign vcMessage = "":U.
if vcActivityCode <> "PC-Transfer":U and
tqJournalByJournalLayerType.tcJournalTypeCode = {&JOURNALTYPE-PERIODICCOSTING}
then assign vcMessage = trim(substitute(#T-46'The target-daybook-code (&1) cannot have daybook-type &2 as you started activity &3.':255(332055949)T-46#,icTargetJournalCode,{&JOURNALTYPE-PERIODICCOSTING-TR},vcActivityCode)).
else if vcActivityCode = "PC-Transfer":U and
tqJournalByJournalLayerType.tcJournalTypeCode <> {&JOURNALTYPE-PERIODICCOSTING}
then assign vcMessage = trim(substitute(#T-47'The target-daybook-code (&1) should have daybook-type &2 as you started activity &3.':255(227638444)T-47#,icTargetJournalCode,{&JOURNALTYPE-PERIODICCOSTING-TR},vcActivityCode)).
if vcMessage <> "":U
then do :
<M-44 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-9816':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end. /* if vcMessage <> "":U */
assign oiTargetJournalId = tqJournalByJournalLayerType.tiJournal_ID
ocTargetJournalTypeCode = tqJournalByJournalLayerType.tcJournalTypeCode.
/* is type of journal same as type of target journal */
if vcJournalTypeCode <> ? and
vcJournalTypeCode <> ocTargetJournalTypeCode
then do:
assign vcMessage = (#T-41'The daybook &1 is of type &2 and the target daybook &3 is of type &4. The daybook type must be the same for both daybooks.':200(678139214)T-41#)
vcMessage = trim(substitute(vcMessage,
icJournalCode, vcJournalTypeCode,
icTargetJournalCode, ocTargetJournalTypeCode)).
<M-40 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-4769':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMassLayerTransfer>
assign oiReturnStatus = -1.
return.
end.
/* =================================================================== */
/* If everythink was OK set-up this */
/* =================================================================== */
if oiReturnStatus = -98 then assign oiReturnStatus = 0.