Description
Add code here to initialize the calculated fields of the class temp-tables after loading existing records from the application database.
Parameters
oiReturnStatus | output | integer | |
Internal usage
unused
program code (program/bdomain.p)
<ANCESTOR-CODE>
if oiReturnStatus < 0 then return.
assign
oiReturnStatus = -98
viLocalReturnStatus = 0.
empty temp-table tDomainPropertyRefer.
empty temp-table tInitialDomainPropertyRefer.
for each tDomains :
/* ========================================================================================================================= */
/* DomainProperty: execute a query and put the result in an instance dependant temp-table that then can be updated on the UI */
/* ========================================================================================================================= */
if not can-find (tDomainPropertyRefer where tDomainPropertyRefer.Domain_ID = tDomains.Domain_ID)
then do :
if vlStartQueries = false
then do:
<Q-6 run DomainForInterCompany (Start) in BDomain >
<Q-11 run DomainForCalculate (Start) in BDomain >
assign vlStartQueries = true.
end.
<Q-13 run DomainForCalculate (all) (Read) (NoCache)
(input tDomains.Domain_ID, (DomainID)
input ?, (DomainCode)
input ?, (CompanyID)
output dataset tqDomainForCalculate) in BDomain >
find first tqDomainForCalculate no-error.
if not available tqDomainForCalculate
then do:
assign vhFcComponent = ?
viLocalReturnStatus = -25. /* Database Corruption */
<M-9 run CreateCorruption
(input 'Domains':U (icTableName),
input string(tDomains.Domain_ID) (icKey),
input trim(#T-10'Domain Properties could not be found.':100(59470)T-10#) (icDescription),
input ? (ilSkipMessage),
output viFcReturnSuper (oiReturnStatus)) in BCorrLog>
leave.
end.
create tDomainPropertyRefer.
assign tDomainPropertyRefer.Currency_ID = tqDomainForCalculate.tiCurrency_ID
tDomainPropertyRefer.Domain_ID = tqDomainForCalculate.tiDomain_ID
tDomainPropertyRefer.DomainProperty_ID = tqDomainForCalculate.tiDomainProperty_ID
/* COA Mask */
tDomainPropertyRefer.DomainPropertyIsMaskCC = tqDomainForCalculate.tlDomainPropertyIsMaskCC
tDomainPropertyRefer.DomainPropertyIsMaskDiv = tqDomainForCalculate.tlDomainPropertyIsMaskDiv
tDomainPropertyRefer.DomainPropertyIsMaskProj = tqDomainForCalculate.tlDomainPropertyIsMaskProj
tDomainPropertyRefer.DomainPropertyIsMaskCCAll = tqDomainForCalculate.tlDomainPropertyIsMaskCCAll
tDomainPropertyRefer.DomainPropertyIsMaskDivAll = tqDomainForCalculate.tlDomainPropertyIsMaskDivAll
tDomainPropertyRefer.DomainPropertyIsMaskPrjAll = tqDomainForCalculate.tlDomainPropertyIsMaskPrjAll
tDomainPropertyRefer.DomainPropertyIsWHT = tqDomainForCalculate.tlDomainPropertyIsWHT
tDomainPropertyRefer.DomainPropertyWHTDueMoment = (if tqDomainForCalculate.tcDomainPropertyWHTDueMoment <> "" and
tqDomainForCalculate.tcDomainPropertyWHTDueMoment <> ?
then tqDomainForCalculate.tcDomainPropertyWHTDueMoment
else {&DOCUMENTSTATUS-PAID})
tDomainPropertyRefer.DomainPropertyIsTaxValid = tqDomainForCalculate.tlDomainPropertyIsTaxValid
tDomainPropertyRefer.tcCurrencyCode = tqDomainForCalculate.tcCurrencyCode
tDomainPropertyRefer.DomainPropertyCodePage = tqDomainForCalculate.tcDomainPropertyCodePage
tDomainPropertyRefer.DomainPropertyName = tqDomainForCalculate.tcDomainPropertyName
tDomainPropertyRefer.DomainPropertySearchName = tqDomainForCalculate.tcDomainPropertySearchName
tDomainPropertyRefer.DomainPropertyIsSetupCompl = tqDomainForCalculate.tlDomainPropertyIsSetupCompl
tDomainPropertyRefer.IntercoAPGL_ID = tqDomainForCalculate.tiIntercoAPGL_ID
tDomainPropertyRefer.IntercoARGL_ID = tqDomainForCalculate.tiIntercoARGL_ID
tDomainPropertyRefer.IntercoFAGL_ID = tqDomainForCalculate.tiIntercoFAGL_ID
tDomainPropertyRefer.IntercoICGL_ID = tqDomainForCalculate.tiIntercoICGL_ID
tDomainPropertyRefer.IntercoJEGL_ID = tqDomainForCalculate.tiIntercoJEGL_ID
tDomainPropertyRefer.tcIntercoAPGLCode = tqDomainForCalculate.tcIntercoAPGLCode
tDomainPropertyRefer.tcIntercoARGLCode = tqDomainForCalculate.tcIntercoARGLCode
tDomainPropertyRefer.tcIntercoFAGLCode = tqDomainForCalculate.tcIntercoFAGLCode
tDomainPropertyRefer.tcIntercoICGLCode = tqDomainForCalculate.tcIntercoICGLCode
tDomainPropertyRefer.tcIntercoJEGLCode = tqDomainForCalculate.tcIntercoJEGLCode
tDomainPropertyRefer.DomainPropertyIsStatutory = tqDomainForCalculate.tlDomainPropertyIsStatutory
tDomainPropertyRefer.DomainPropertyIsConsecutNr = tqDomainForCalculate.tlDomainPropertyIsConsecutNr
tDomainPropertyRefer.DomainPropertyIsPopupInvNr = tqDomainForCalculate.tlDomainPropertyIsPopupInvNr
tDomainPropertyRefer.DomainPropertyIsChronolNr = tqDomainForCalculate.tlDomainPropertyIsChronolNr
tDomainPropertyRefer.DomainPropertyNonChronErr = tqDomainForCalculate.tcDomainPropertyNonChronErr
tDomainPropertyRefer.DomainPropertyIsInvCertific = tqDomainForCalculate.tlDomainPropertyIsInvCertific
tDomainPropertyRefer.DomainPropertyIsPIBFLogEnabled = tqDomainForCalculate.tlDomainPropertyIsPIBFLogEnabled
tDomainPropertyRefer.tc_Rowid = tqDomainForCalculate.tc_rowid
tDomainPropertyRefer.tc_ParentRowid = tDomains.tc_Rowid.
/* Statutory currency can't be included in the original query, because the records will be loaded once before the conversion of Statutory currency has finished */
/* This code is only necessary as long as we have SP4 customers. Later it can be done with 1 query */
<Q-14 run DomainForInterCompany (all) (Read) (NoCache)
(input tDomains.Domain_ID, (DomainID)
input ?, (DomainCode)
input ?, (CompanyID)
output dataset tqDomainForInterCompany) in BDomain >
find first tqDomainForInterCompany no-error.
if available tqDomainForInterCompany
then assign tDomainPropertyRefer.StatutoryCurrency_ID = tqDomainForInterCompany.tiStatutoryCurrency_ID
tDomainPropertyRefer.tcStatutoryCurrencyCode = tqDomainForInterCompany.tcStatutoryCurrencyCode.
/* retreive credit term for deductions */
if tqDomainForCalculate.tiDeductPaymentCondition_ID <> ? and tqDomainForCalculate.tiDeductPaymentCondition_ID > 0
then do:
<Q-92 run PaymentConditionPrim (all) (Read) (NoCache)
(input tqDomainForCalculate.tiDeductPaymentCondition_ID, (PaymentConditionId)
input ?, (PaymentConditionCode)
output dataset tqPaymentConditionPrim) in BPaymentCondition>
find first tqPaymentConditionPrim no-error.
if available tqPaymentConditionPrim
then assign tDomainPropertyRefer.DeductPaymentCondition_ID = tqPaymentConditionPrim.tiPaymentCondition_ID
tDomainPropertyRefer.tcPaymentConditionDeduction = tqPaymentConditionPrim.tcPaymentConditionCode.
end.
if tqDomainForCalculate.tiPrepayPaymentCondition_ID <> ? and tqDomainForCalculate.tiPrepayPaymentCondition_ID > 0
then do:
<Q-73 run PaymentConditionPrim (all) (Read) (NoCache)
(input tqDomainForCalculate.tiPrepayPaymentCondition_ID, (PaymentConditionId)
input ?, (PaymentConditionCode)
output dataset tqPaymentConditionPrim) in BPaymentCondition>
find first tqPaymentConditionPrim no-error.
if available tqPaymentConditionPrim
then assign tDomainPropertyRefer.PrepayPaymentCondition_ID = tqPaymentConditionPrim.tiPaymentCondition_ID
tDomainPropertyRefer.tcPaymentConditionPrepay = tqPaymentConditionPrim.tcPaymentConditionCode.
end.
/* ================================================================================================================ */
/* Hold the initial values of DomainProperty in an additional table so we can check for changes in AddtionalUpdates */
/* ================================================================================================================ */
create tInitialDomainPropertyRefer.
buffer-copy tDomainPropertyRefer to tInitialDomainPropertyRefer.
end. /* if not can-find(...) */
end. /* for each tDomains */
/* ============ */
/* Stop Queries */
/* ============ */
if vlStartQueries = true
then do:
<Q-7 run DomainForInterCompany (Stop) in BDomain >
<Q-12 run DomainForCalculate (Stop) in BDomain >
assign vlStartQueries = false.
end. /* if vlStartQueries = true */
assign oiReturnStatus = viLocalReturnStatus.