project QadFinancials > class BAPMatching > method AdditionalUpdatesAllCosts
Description
Add additional posting lines that were passed by the integration.
Parameters
icAPMatchingPostingRowID | input | character | Posting Rowid of the matching posting |
icPostingText | input | character | Posting Text |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bapmatching.p)
/* ==================================================================== */
/* Add Posting lines based on the temp-table records in tAPMatchingCost */
/* Make sure you keep this method in the same segment as the calling */
/* method as it will use the record that's available in the caller. */
/* ==================================================================== */
empty temp-table tDefaultSafsAPM.
/* ============================================================================ */
/* First check whether everything is availablable what is supposed to be avail */
/* ============================================================================ */
if not available tAPMatchingCost
then do :
assign oiReturnStatus = -3
vcMsgAPMatching = trim(substitute(#T-57'Internal error: information is missing.':255(49818)T-57#)) + chr(10) +
trim(substitute(#T-49'Available matching cost record: &1.':234(37889666)T-49#,available (tAPMatchingCost))) .
<M-56 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-68558':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
Return.
end. /* if not avail */
/* Fill the temp-table with the safs that were passed */
for each tAPMatchingCostSaf where
tAPMatchingCostSaf.tc_ParentRowid = tAPMatchingCost.tc_Rowid and
tAPMatchingCostSaf.tcSafCode <> "" and
tAPMatchingCostSaf.tcSafCode <> ? and
tAPMatchingCostSaf.tcSafConcept <> "" and
tAPMatchingCostSaf.tcSafConcept <> ?
on error undo, throw:
create tDefaultSafsAPM.
assign tDefaultSafsAPM.tcSafConceptCode = tAPMatchingCostSaf.tcSafConcept
tDefaultSafsAPM.tcSafCode = tAPMatchingCostSaf.tcSafCode.
end. /* for each tAPMatchingCostSaf where */
/* Fill allocation key with Allocation Key + Allocation type seperated by chr(2) */
assign vcAllocationKey = tAPMatchingCost.tcAllocationKey + chr(2) + tAPMatchingCost.tcAllocationType.
/* Check if we need to call AddStandardPosting or AddPostingLineTax */
<Q-45 run GLByCode (all) (Read) (Cache)
(input viCompanyId, (CompanyId)
input tAPMatchingCost.tcGLCode, (GLCode)
output dataset tqGLByCode) in BGL>
find first tqGLByCode where
tqGLByCode.tcGLCode = tAPMatchingCost.tcGLCode
no-lock no-error.
if not available tqGLByCode
then do:
assign vcMessage = substitute(#T-23'Could not find the GL account (&1) that was passed for the additional posting lines.':255(41329164)T-23#, tAPMatchingCost.tcGLCode)
oiReturnStatus = -1.
<M-54 run SetMessage
(input vcMessage (icMessage),
input '' (icArguments),
input 'tAPMatchingCost.tcGLCode' (icFieldName),
input tAPMatchingCost.tcGLCode (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input tAPMatchingCost.tc_Rowid (icRowid),
input 'qadfin-310594':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
return.
end.
assign vcPostingLineText = if tAPMatchingCost.tcLineText = ? or
tAPMatchingCost.tcLineText = "":U
then icPostingText
else tAPMatchingCost.tcLineText.
if tqGLByCode.tcGLTypeCode <> {&GLTYPECODE-VAT}
then do:
/* Call AddStandardPosting */
<M-68 run AddStandardPosting
(input icAPMatchingPostingRowID (icPostingtcRowid),
input tAPMatchingCost.tcGLCode (icGLCode),
input tAPMatchingCost.tcDivisionCode (icDivisionCode),
input tAPMatchingCost.tcCostCentreCode (icCostCentreCode),
input '':U (icCostCentreText),
input tAPMatchingCost.tcProjectCode (icProjectCode),
input '':U (icProjectText),
input '':U (icIntercoBusinessRelationCode),
input tAPMatchingCost.tcCurrencyCode (icCurrencyCode),
input tAPMatchingCost.tdDebitTC (idDebitTC),
input tAPMatchingCost.tdDebitLC (idDebitLC),
input tAPMatchingCost.tdDebitCC (idDebitCC),
input 0 (idDebitPC),
input tAPMatchingCost.tdCreditTC (idCreditTC),
input tAPMatchingCost.tdCreditLC (idCreditLC),
input tAPMatchingCost.tdCreditCC (idCreditCC),
input 0 (idCreditPC),
input 0 (idQty),
input vcPostingLineText (icLineText),
input '':U (icSafText),
input tDefaultSafsAPM (tDefaultSafs),
input tAPMatchingCost.tcExchangeRateType (icExchangeRateType),
input tAPMatchingCost.tdExchangeRate (idExchangeRate),
input tAPMatchingCost.tdExchangeRateScale (idExchangeRateScale),
input tAPMatchingCost.tdPostingLineCCRate (idPostingLineCCRate),
input tAPMatchingCost.tdPostingLineCCScale (idPostingLineCCScale),
output viPostingLineId (oiPostingLineId),
input 0 (iiSafStructureId),
input tAPMatchingCost.tcSafStructureCode (icSafStructureCode),
input vcAllocationKey (icAllocationKey),
input false (ilLinkedCrCyDaemonReqExists),
input tAPMatchingCost.ttExchangeRateDate (itExchangeRateDate),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
/* I19 requirement for Brazil =============================================================== */
/* If the AP matching is for the Legal document, all posting lines needs to contain reference */
/* to this legal document */
/* ========================================================================================== */
if vcLegalDocNbr <> ? or
vcLegalDocNbr <> '':U
then do:
<M-1 run SetPostingLineLegalDocNumber
(input ? (icPostingLineTcRowID),
input viPostingLineId (iiPostingLineID),
input vcLegalDocNbr (icLegalDocumentNumber),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
end. /* if vcLegalDocNbr <> ? */
end. /* if tqGLByCode.tcGLTypeCode <> {&GLTYPECODE-VAT} */
else do:
/* call AddPostingLineTax */
<M-36 run AddPostingLineTax
(input icAPMatchingPostingRowID (icPostingTcRowid),
input tAPMatchingCost.ttTaxPointDate (itTaxPointDate),
input vcPostingLineText (icPostingLineText),
input tAPMatchingCost.tcCurrencyCode (icCurrencyCode),
input tAPMatchingCost.tcPostingVatInOut (icPostingVatInOut),
input tAPMatchingCost.tcPostingVatCode (icPostingVatCode),
input tAPMatchingCost.tcPostingVatDomain (icPostingVatDomain),
input tAPMatchingCost.tdExchangeRate (idExchangeRate),
input tAPMatchingCost.tdExchangeRateScale (idExchangeRateScale),
input tAPMatchingCost.tcExchangeRateType (icExchangeRateType),
input tAPMatchingCost.tdPostingLineCCRate (idCCExchangeRate),
input tAPMatchingCost.tdPostingLineCCScale (idCCExchangeRateScale),
input tAPMatchingCost.tcTransactionType (icTransactionType),
input tAPMatchingCost.tcTaxTransactionType (icTaxTransactionType),
input tAPMatchingCost.tdBaseDebitTC (idBaseDebitTC),
input tAPMatchingCost.tdBaseCreditTC (idBaseCreditTC),
input tAPMatchingCost.tdBaseDebitLC (idBaseDebitLC),
input tAPMatchingCost.tdBaseCreditLC (idBaseCreditLC),
input tAPMatchingCost.tdBaseDebitCC (idBaseDebitCC),
input tAPMatchingCost.tdBaseCreditCC (idBaseCreditCC),
input tAPMatchingCost.tdVatDebitTC (idVatDebitTC),
input tAPMatchingCost.tdVatCreditTC (idVatCreditTC),
input tAPMatchingCost.tdVatDebitLC (idVatDebitLC),
input tAPMatchingCost.tdVatCreditLC (idVatCreditLC),
input tAPMatchingCost.tdVatDebitCC (idVatDebitCC),
input tAPMatchingCost.tdVatCreditCC (idVatCreditCC),
input tAPMatchingCost.tcGLCode (icNormalTaxGLCode),
input tAPMatchingCost.tcDivisionCode (icNormalTaxDivisionCode),
input tAPMatchingCost.tlNormalTaxIsAlreadyAbsRet (ilNormalTaxIsAlreadyAbsRet),
input tAPMatchingCost.tcAbsRetTaxGLCode (icAbsRetTaxGLCode),
input tAPMatchingCost.tcAbsRetTaxDivisionCode (icAbsRetTaxDivisionCode),
input tAPMatchingCost.tcFromTaxZone (icFromTaxZone),
input tAPMatchingCost.tcToTaxZone (icToTaxZone),
input tAPMatchingCost.tcTaxEnvironment (icTaxEnvrionment),
input tAPMatchingCost.tlIsTaxable (ilIsTaxable),
input tAPMatchingCost.tcTaxClass (icTaxClass),
input tAPMatchingCost.tcTaxUsage (icTaxUsage),
input tAPMatchingCost.tcTaxType (icTaxType),
input tAPMatchingCost.tlTaxIsReverseChargeDomestic (ilTaxIsReverseChargeDomestic),
input tAPMatchingCost.tiTaxAddressID (iiTaxAddressID),
input tAPMatchingCost.tcTaxIDFeder (icTaxIDFeder),
input tAPMatchingCost.tcTaxIDState (icTaxIDState),
input tAPMatchingCost.tcTaxIDMisc1 (icTaxIDMisc1),
input tAPMatchingCost.tcTaxIDMisc2 (icTaxIDMisc2),
input tAPMatchingCost.tcTaxIDMisc3 (icTaxIDMisc3),
input tAPMatchingCost.tiOwnAddressID (iiOwnAddressID),
input tAPMatchingCost.tcOwnTaxIDFeder (icOwnTaxIDFeder),
input tAPMatchingCost.tcOwnTaxIDState (icOwnTaxIDState),
input tAPMatchingCost.tcOwnTaxIDMisc1 (icOwnTaxIDMisc1),
input tAPMatchingCost.tcOwnTaxIDMisc2 (icOwnTaxIDMisc2),
input tAPMatchingCost.tcOwnTaxIDMisc3 (icOwnTaxIDMisc3),
input tAPMatchingCost.tiOwnTaxIDDeclarat (iiOwnTaxIDDeclarat),
input tAPMatchingCost.tlIsSuspDel (ilIsSuspDel),
output viNormalTaxPostingLineID (oiNormalTaxPostingLineID),
output vcNormalTaxPostingLineTcRowid (ocNormalTaxPostingLineTcRowid),
output viAbsRetTaxPostingLineID (oiAbsRetTaxPostingLineID),
output vcAbsRetTaxPostingLineTcRowid (ocAbsRetTaxPostingLineTcRowid),
output viNormalTaxPostingVatID (oiNormalTaxPostingVatID),
input false (ilLinkedCrCyDaemonReqExists),
input tAPMatchingCost.tlCalledFromMoveSuspDelTax (ilCalledFromMoveSuspDelTax),
input tAPMatchingCost.ttExchangeRateDate (itInvoiceExchangeRateDate),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
/* I19 requirement for Brazil =============================================================== */
/* If the AP matching is for the Legal document, all posting lines needs to contain reference */
/* to this legal document */
/* ========================================================================================== */
if vcLegalDocNbr <> ? or
vcLegalDocNbr = ''
then do:
<M-46 run SetPostingLineLegalDocNumber
(input ? (icPostingLineTcRowID),
input viNormalTaxPostingLineID (iiPostingLineID),
input vcLegalDocNbr (icLegalDocumentNumber),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper <> 0 and oiReturnStatus >= 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
if viAbsRetTaxPostingLineID <> ? and
viAbsRetTaxPostingLineID <> 0
then do:
<M-70 run SetPostingLineLegalDocNumber
(input ? (icPostingLineTcRowID),
input viAbsRetTaxPostingLineID (iiPostingLineID),
input vcLegalDocNbr (icLegalDocumentNumber),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper <> 0 and oiReturnStatus >= 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.
end.
end. /* if vcLegalDocNbr <> ? */
end. /* else do: (vat account) */