project QadFinancials > class BDInvoice > method CreateDInvoiceMovementsRoundDiffCC
Description
Extended method of CreateDInvoiceMovements.
This method will post the CC balance difference when TC is completely balanced.
Parameters
idDiffDebit | input | decimal | |
idDiffCredit | input | decimal | |
icDBusinessRelationInterCode | input | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program3/bdinvoice.p)
/* NOTE: Make sure this method is in the same segment as the calling method */
/* ============================= */
/* Retrieve the rounding account */
/* ============================= */
<Q-85 run GLByGLSystemType (all) (Read) (Cache)
(input viCompanyId, (CompanyId)
input {&GLSYSTEMTYPE-ROUND}, (GLSystemTypeCode)
input {&GLTYPECODE-SYST}, (GlTypeCode)
input ?, (GlIsDivisionAccount)
output dataset tqGLByGLSystemType) in BGL >
find first tqGLByGLSystemType where
tqGLByGLSystemType.tcGLSystemTypeCode = {&GLSYSTEMTYPE-ROUND} and
tqGLByGLSystemType.tcGLTypeCode = {&GLTYPECODE-SYST}
no-error.
if not available tqGLByGLSystemType
then do:
<M-44 run SetMessage
(input trim(#T-35'The system account for rounding differences has not been defined.':250(16626)T-35#) (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-66758':U:U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
assign oiReturnStatus = -1.
return.
end.
/* ============================== */
/* Post the CC balance difference */
/* ============================== */
assign vdRoundDebitCC = if idDiffDebit > 0 then idDiffDebit else if idDiffCredit < 0 then abs(idDiffCredit) else 0
vdRoundCreditCC = if idDiffCredit > 0 then idDiffCredit else if idDiffDebit < 0 then abs(idDiffDebit) else 0.
<M-28 run AddStandardPosting
(input tDIMovement.tcPostingRowId (icPostingtcRowid),
input tqGLByGLSystemType.tcGLCode (icGLCode),
input ? (icDivisionCode),
input tDInvoice.tcCostCentreCode (icCostCentreCode),
input ? (icCostCentreText),
input tDInvoice.tcProjectCode (icProjectCode),
input ? (icProjectText),
input icDBusinessRelationInterCode (icIntercoBusinessRelationCode),
input vcCompanyCC (icCurrencyCode),
input 0 (idDebitTC),
input 0 (idDebitLC),
input vdRoundDebitCC (idDebitCC),
input 0 (idDebitPC),
input 0 (idCreditTC),
input 0 (idCreditLC),
input vdRoundCreditCC (idCreditCC),
input 0 (idCreditPC),
input 0 (idQty),
input ? (icLineText),
input ? (icSafText),
input tDefaultSafsDI (tDefaultSafs),
input {&EXCHANGERATETYPE-STATUTORY} (icExchangeRateType),
input 1 (idExchangeRate),
input 1 (idExchangeRateScale),
input 1 (idPostingLineCCRate),
input 1 (idPostingLineCCScale),
output viDummy (oiPostingLineId),
input ? (iiSafStructureId),
input ? (icSafStructureCode),
input ? (icAllocationKey),
input false (ilLinkedCrCyDaemonReqExists),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.