project QadFinancials > class BDInvoice > method CreateDInvoiceMovementsRoundDiff
Description
Extended method of CreateDInvoiceMovements.
This method will post the LC 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-1 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-2 run SetMessage
(input trim(#T-4'The system account for rounding differences has not been defined.':250(16626)T-4#) (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-9620':U:U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
assign oiReturnStatus = -1.
return.
end.
/* ============================== */
/* Post the LC balance difference */
/* ============================== */
assign vdRoundDebitLC = if idDiffDebit > 0 then idDiffDebit else if idDiffCredit < 0 then abs(idDiffCredit) else 0
vdRoundCreditLC = if idDiffCredit > 0 then idDiffCredit else if idDiffDebit < 0 then abs(idDiffDebit) else 0.
<M-3 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 vcCompanyLC (icCurrencyCode),
input 0 (idDebitTC),
input vdRoundDebitLC (idDebitLC),
input 0 (idDebitCC),
input 0 (idDebitPC),
input 0 (idCreditTC),
input vdRoundCreditLC (idCreditLC),
input 0 (idCreditCC),
input 0 (idCreditPC),
input 0 (idQty),
input ? (icLineText),
input ? (icSafText),
input tDefaultSafsDI (tDefaultSafs),
input {&EXCHANGERATETYPE-ACCOUNTING} (icExchangeRateType),
input 1 (idExchangeRate),
input 1 (idExchangeRateScale),
input 1 (idPostingLineCCRate),
input 1 (idPostingLineCCScale),
output viDummy (oiPostingLineId),
input ? (iiSafStructureId),
input ? (icSafStructureCode),
input ? (icAllocationKey),
output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then return.