project QadFinancials > class BAPMatching > method PostSaveUpdateOperationals
Description
Perform update of operational data related to save of receiver matching
Parameters
Internal usage
unused
program code (program6/bapmatching.p)
/* ================== */
/* Exception handling */
/* ================== */
assign oiReturnStatus = -98
viLocalReturnStatus = 0
vlBJEOpenedInThisMethod = false.
/* ============================ */
/* Open journal entry component */
/* ============================ */
if viBJournalEntryAPMID <> 0 and
viBJournalEntryAPMID <> ? and
not valid-handle(vhBJournalEntryAPMInst)
then do:
<I-1 {bFcOpenInstance
&CLASS = "BJournalEntry"}>
assign vlBJEOpenedInThisMethod = true.
end. /* if viBJournalEntryAPMID <> 0 and */
INFOBLOCK: DO:
/* ================================================================ */
/* get all information of the posting lines of the matching posting */
/* ================================================================ */
for each tAPMatchingLn where
tAPMatchingLn.tc_Status <> "D":U and
tAPMatchingLn.VarRatePostingLine_ID <> 0 and
tAPMatchingLn.VarRatePostingLine_ID <> ?,
each tAPMatching where
tAPMatching.tc_Status <> "D":U:
create tVarRatePostingLineDetailAPM.
assign tVarRatePostingLineDetailAPM.tiPostingLineID = tAPMatchingLn.VarRatePostingLine_ID.
if valid-handle (vhBJournalEntryAPMInst)
then do:
<M-2 run GetPostingLineInfoById
(input tAPMatchingLn.VarRatePostingLine_ID (iiPostingLineID),
output tVarRatePostingLineDetailAPM.tiPostingYear (oiPostingYear),
output tVarRatePostingLineDetailAPM.tcPostingJournalCode (ocPostingJournalCode),
output tVarRatePostingLineDetailAPM.tiPostingVoucher (oiPostingVoucher),
output tVarRatePostingLineDetailAPM.ttPostingDate (otPostingDate),
output tVarRatePostingLineDetailAPM.tcGLCode (ocGLCode),
output tVarRatePostingLineDetailAPM.tcDivisionCode (ocDivisionCode),
output tVarRatePostingLineDetailAPM.tcProjectCode (ocProjectCode),
output tVarRatePostingLineDetailAPM.tcCostCentreCode (ocCostCentreCode),
output viExternalReturnStatus (oiReturnStatus)) in BJournalEntry>
if viExternalReturnStatus <> 0 then assign viLocalReturnStatus = viExternalReturnStatus.
if viExternalReturnStatus < 0 then leave INFOBLOCK.
end.
else do:
if not vlStartPostingLineByCCProj
then do:
<Q-7 run PostingLineByCostCentreProject (Start) in BPosting >
assign vlStartPostingLineByCCProj = true.
end.
<Q-3 run PostingLineByCostCentreProject (all) (Read) (NoCache)
(input ?, (CompanyId)
input ?, (CostCentreID)
input ?, (ProjectID)
input ?, (PostingDateFrom)
input ?, (PostingDateTill)
input tAPMatchingLn.VarRatePostingLine_ID, (PostingLineID)
output dataset tqPostingLineByCostCentreProject) in BPosting >
find first tqPostingLineByCostCentreProject where
tqPostingLineByCostCentreProject.tiPostingLine_ID = tAPMatchingLn.VarRatePostingLine_ID
no-error.
if not available tqPostingLineByCostCentreProject
then do:
assign viLocalReturnStatus = -3
vcMsgAPMatching = trim(substitute(#T-17'No Posting Line Information of Matching Posting found.':255(999890726)T-17#)).
<M-16 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-9250':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
leave INFOBLOCK.
end.
assign tVarRatePostingLineDetailAPM.ttPostingDate = tqPostingLineByCostCentreProject.ttPostingDate
tVarRatePostingLineDetailAPM.tiPostingYear = tqPostingLineByCostCentreProject.tiPostingYear
tVarRatePostingLineDetailAPM.tiPostingVoucher = tqPostingLineByCostCentreProject.tiPostingVoucher
tVarRatePostingLineDetailAPM.tcPostingJournalCode = tqPostingLineByCostCentreProject.tcJournalCode
tVarRatePostingLineDetailAPM.tcPostingReference = string(tqPostingLineByCostCentreProject.tiPostingYear, "9999":U) + "/":U +
tqPostingLineByCostCentreProject.tcJournalCode + "/":U +
string(tqPostingLineByCostCentreProject.tiPostingVoucher, " 999999999":U)
tVarRatePostingLineDetailAPM.tcGLCode = tqPostingLineByCostCentreProject.tcGLCode
tVarRatePostingLineDetailAPM.tcDivisionCode = tqPostingLineByCostCentreProject.tcDivisionCode
tVarRatePostingLineDetailAPM.tcProjectCode = tqPostingLineByCostCentreProject.tcProjectCode
tVarRatePostingLineDetailAPM.tcCostCentreCode = tqPostingLineByCostCentreProject.tcCostCentreCode.
end.
end. /* end for each */
/* =========================================== */
/* get all information of the supplier invoice */
/* =========================================== */
for each tAPMatching where
tAPMatching.tc_Status <> "D":U :
create tCInvoiceDetailAPM.
assign tCInvoiceDetailAPM.tiCInvoiceID = tAPMatching.CInvoice_ID.
if not vlStartCInvoiceByMatchingInfo
then do:
<Q-9 run CInvoiceByMatchingInfo (Start) in BCInvoice >
assign vlStartCInvoiceByMatchingInfo = true.
end.
<Q-6 run CInvoiceByMatchingInfo (all) (Read) (NoCache)
(input ?, (CompanyId)
input tAPMatching.CInvoice_ID, (CInvoiceID)
output dataset tqCInvoiceByMatchingInfo) in BCInvoice >
find first tqCInvoiceByMatchingInfo where
tqCInvoiceByMatchingInfo.tiCInvoice_ID = tAPMatching.CInvoice_ID
no-error.
if not available tqCInvoiceByMatchingInfo
then do:
assign viLocalReturnStatus = -3
vcMsgAPMatching = trim(substitute(#T-19'No Supplier Invoice Information found.':255(999890727)T-19#)).
<M-18 run SetMessage
(input vcMsgAPMatching (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-9251':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
leave INFOBLOCK.
end.
assign tCInvoiceDetailAPM.tcGLCode = tqCInvoiceByMatchingInfo.tcGLCode
tCInvoiceDetailAPM.tcDivisionCode = tqCInvoiceByMatchingInfo.tcDivisionCode
tCInvoiceDetailAPM.tcProjectCode = tqCInvoiceByMatchingInfo.tcProjectCode
tCInvoiceDetailAPM.tcCostCentreCode = tqCInvoiceByMatchingInfo.tcCostCentreCode.
end.
END. /* END BLOCK */
if vlBJEOpenedInThisMethod
then do:
<I-5 {bFcCloseInstance
&CLASS = "BJournalEntry"}>
end. /* if valid-handle(vhBJournalEntryAPMInst) */
if vlStartPostingLineByCCProj
then do:
<Q-8 run PostingLineByCostCentreProject (Stop) in BPosting >
end.
if vlStartCInvoiceByMatchingInfo
then do:
<Q-10 run CInvoiceByMatchingInfo (Stop) in BCInvoice >
end.
/* =============================== */
/* real update of operational data */
/* =============================== */
if can-find(first tVarRatePostingLineDetailAPM) or
can-find(first tCInvoiceDetailAPM)
then do:
<I-11 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "false"
&CLASS = "PMfgProUpdateOperFromAPM"}>
<M-12 run UpdateOperationalsFromAPM
(input {&TARGETPROCEDURE} (ihCallerHandle),
input ? (icDomainCode),
input ? (iiDomainID),
input ? (icUserLogin),
input ? (icGlobalLanguage),
input tCInvoiceDetailAPM (tCInvoiceDetail),
input tVarRatePostingLineDetailAPM (tVarRatePostingLineDetail),
input tAPMatching (tAPMatching),
input tAPMatchingLn (tAPMatchingLn),
input tInitialAPMatching (tiAPMatching),
input tInitialAPMatchingLn (tiAPMatchingLn),
output viExternalReturnStatus (oiReturnStatus)) in PMfgProUpdateOperFromAPM>
<I-13 {bFcCloseAndStopInstance
&CLASS = "PMfgProUpdateOperFromAPM"}>
if viExternalReturnStatus <> 0 then assign viLocalReturnStatus = viExternalReturnStatus.
if viExternalReturnStatus < 0 then return.
end.
/* ===================== */
/* Set ReturnStatus = OK */
/* ===================== */
assign oiReturnStatus = viLocalReturnStatus.