project QadFinancials > class BJournalEntry > method GetPostingAmountByPostingLineId
Description
look in instance tables for the posting line and return the amounts
Parameters
iiPostingLineId | input | integer | Posting Line ID |
odPostingAmountCreditLC | output | decimal | Credit Posting Amount LC |
odPostingAmountCreditTC | output | decimal | Credit posting amount TC |
odPostingAmountCreditCC | output | decimal | Credit Posting Amount CC |
odPostingAmountDebitLC | output | decimal | Debit Posting Amount LC |
odPostingAmountDebitTC | output | decimal | Debit Posting Amount TC |
odPostingAmountDebitCC | output | decimal | Debit Posting Amount CC |
oiGLId | output | integer | GL id |
oiDivisionId | output | integer | Division ID |
oiProjectId | output | integer | Project ID |
oiJournalId | output | integer | Journal ID |
oiCostCentreId | output | integer | Cost Centre ID |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program6/bjournalentry.p)
/* =============== */
/* get the posting */
/* =============== */
find first tPostingLine where
tPostingLine.PostingLine_ID = iiPostingLineId
no-error.
if not available tPostingLine or
tPostingLine.tc_Status = "D":U
then return.
find first tPosting where
tPosting.tc_Rowid = tPostingLine.tc_ParentRowid
no-error.
if not available tPosting
then do:
assign vcMessage = trim(#T-7'Missing posting data':255(999890293)T-7#) .
<M-8 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'S':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-8990':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
assign oiReturnStatus = -1.
return.
end.
/*CA707537 this method created and called so that CC amounts are calculated before being sent for invoice movement updates*/
if (tPostingLine.PostingLineDebitCC = 0 or tPostingLine.PostingLineDebitCC = ?) and
(tPostingLine.PostingLineCreditCC = 0 or tPostingLine.PostingLineCreditCC = ?)
then
<M-6 run CalculateCCAmount
(input tPosting.Company_ID (iiCompanyID),
input tPostingLine.PostingLineCreditLC (idPostingLineCreditLC),
input tPostingLine.PostingLineCreditTC (idPostingLineCreditTC),
input tPostingLine.PostingLineDebitLC (idPostingLineDebitLC),
input tPostingLine.PostingLineDebitTC (idPostingLineDebitTC),
input tPosting.PostingDate (itPostingDate),
input tPostingLine.tcCurrencyCode (icCurrencyCode),
input tPosting.PostingDate (itInvoiceExchangeRateDate),
input-output vdCCExchangeRate (bdCCExchangeRate),
input-output vdCCExchangeRateScale (bdCCExchangeRateScale),
input-output vlCurrencyFetched (blCurrencyFetched),
output tPostingLine.PostingLineCreditCC (odPostingLineCreditCC),
output tPostingLine.PostingLineDebitCC (odPostingLineDebitCC),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>.
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
/* amount = debit - credit */
/* ======================= */
assign odPostingAmountCreditLC = tPostingLine.PostingLineCreditLC
odPostingAmountCreditTC = tPostingLine.PostingLineCreditTC
odPostingAmountCreditCC = tPostingLine.PostingLineCreditCC
odPostingAmountDebitLC = tPostingLine.PostingLineDebitLC
odPostingAmountDebitTC = tPostingLine.PostingLineDebitTC
odPostingAmountDebitCC = tPostingLine.PostingLineDebitCC.
if (tPostingLine.GL_ID = ? or tPostingLine.GL_ID = 0) and
tPostingLine.tcGLCode <> "":U and tPostingLine.tcGLCode <> ?
then do:
<Q-1 run GLPrim (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input tPostingLine.tcGLCode, (GLCode)
input ?, (GLId)
output dataset tqGLPrim) in BGL >
find first tqGLPrim where
tqGLPrim.tcGLCode = tPostingLine.tcGLCode
no-lock no-error.
assign oiGLId = if available tqGLPrim
then tqGLPrim.tiGL_ID
else 0.
end.
else assign oiGLId = tPostingLine.GL_ID.
if (tPostingLine.Division_ID = ? or tPostingLine.Division_ID = 0) and
tPostingLine.tcDivisionCode <> "":U and tPostingLine.tcDivisionCode <> ?
then do:
<Q-2 run DivisionPrim (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input ?, (DivisionID)
input tPostingLine.tcDivisionCode, (DivisionCode)
output dataset tqDivisionPrim) in BDivision >
find first tqDivisionPrim where
tqDivisionPrim.tcDivisionCode = tPostingLine.tcDivisionCode
no-lock no-error.
assign oiDivisionId = if available tqDivisionPrim
then tqDivisionPrim.tiDivision_ID
else 0.
end.
else assign oiDivisionId = tPostingLine.Division_ID.
if (tPostingLine.Project_ID = ? or tPostingLine.Project_ID = 0) and
tPostingLine.tcProjectCode <> "":U and tPostingLine.tcProjectCode <> ?
then do:
<Q-3 run ProjectPrim (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input ?, (ProjectID)
input tPostingLine.tcProjectCode, (ProjectCode)
output dataset tqProjectPrim) in BProject >
find first tqProjectPrim where
tqProjectPrim.tcProjectCode = tPostingLine.tcProjectCode
no-lock no-error.
assign oiProjectId = if available tqProjectPrim
then tqProjectPrim.tiProject_ID
else 0.
end.
else assign oiProjectId = tPostingLine.Project_ID.
if (tPostingLine.CostCentre_ID = ? or tPostingLine.CostCentre_ID = 0) and
tPostingLine.tcCostCentreCode <> "":U and tPostingLine.tcCostCentreCode <> ?
then do:
<Q-4 run CostCentrePrim (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input ?, (CostCentreID)
input tPostingLine.tcCostCentreCode, (CostCentreCode)
output dataset tqCostCentrePrim) in BCostCentre >
find first tqCostCentrePrim where
tqCostCentrePrim.tcCostCentreCode = tPostingLine.tcCostCentreCode
no-lock no-error.
assign oiCostCentreId = if available tqCostCentrePrim
then tqCostCentrePrim.tiCostCentre_ID
else 0.
end.
else assign oiCostCentreId = tPostingLine.CostCentre_ID.
find first tPosting where
tPosting.tc_Rowid = tPostingLine.tc_ParentRowid
no-error.
if available tPosting
then do:
if (tPosting.Journal_ID = ? or tPosting.Journal_ID = 0) and
tPosting.tcJournalCode <> "":U and tPosting.tcJournalCode <> ?
then do:
<Q-5 run JournalPrim (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input tPosting.tcJournalCode, (JournalCode)
input ?, (JournalID)
output dataset tqJournalPrim) in BJournal >
find first tqJournalPrim where
tqJournalPrim.tcJournalCode = tPosting.tcJournalCode
no-lock no-error.
assign oiJournalId = if available tqJournalPrim
then tqJournalPrim.tiJournal_ID
else 0.
end.
else assign oiJournalId = tPosting.Journal_ID.
end.