Description
create a movement record for the given debtor invoice
Parameters
icPostingRowId | input | character | Posting Row ID |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bqcrosscyposting.p)
/* Note: the tQCrossCyPosting record is available here as this method is running in the same segment as the calling method */
/* ===================================================================== */
/* Empty temp-table that is used as input to the call in class BDInvoice */
/* ===================================================================== */
empty temp-table tQCrossCyDDocInvoiceXrefStage.
/* ======================================= */
/* start and/or open the dinvoice instance */
/* ======================================= */
if viBDInvoiceQCrossCyPostID = 0 or viBDInvoiceQCrossCyPostID = ?
then do:
<I-1 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "true"
&CLASS = "BDInvoice"}>
end.
else do:
<I-2 {bFcOpenInstance
&CLASS = "BDInvoice"}>
end.
/* start block */
BlockTransaction:
do:
/* =============================== */
/* create a movement record for it */
/* =============================== */
create tQCrossyCyPostingDIMovement.
assign tQCrossyCyPostingDIMovement.tiDInvoiceId = tQCrossCyPosting.DInvoice_ID
tQCrossyCyPostingDIMovement.tcGLAccountDivisionCode = "":U
tQCrossyCyPostingDIMovement.tdAmountDebitTC = if tQCrossCyPosting.CrossCompanyGLIsCredit = true then tqCrossCyPosting.QCrossCyPostingAmountTC else 0
tQCrossyCyPostingDIMovement.tdAmountCreditTC = if tQCrossCyPosting.CrossCompanyGLIsCredit = false then tqCrossCyPosting.QCrossCyPostingAmountTC else 0
tQCrossyCyPostingDIMovement.tcPostingRowId = icPostingRowId
tQCrossyCyPostingDIMovement.tdMovementDiscountTC = 0
tQCrossyCyPostingDIMovement.tlMovementIsForDraft = false
tQCrossyCyPostingDIMovement.tlIsUndoPayment = false
tQCrossyCyPostingDIMovement.tdMovementDiscountTC = tQCrossCyPosting.QCrossCyPostingDiscAmountTC .
/* Update also staged records */
if tQCrossCyPosting.DDocumentInvoiceXref_ID <> ? and
tQCrossCyPosting.DDocumentInvoiceXref_ID <> 0
then do:
<Q-15 run DDocInvoiceXrefStageByID (all) (Read) (NoCache)
(input tQCrossCyPosting.DDocumentInvoiceXref_ID, (DDocumentInvoiceXrefId)
input ?, (DDocInvoiceXrefStageId)
output dataset tqDDocInvoiceXrefStageByID) in BDDocument>
for each tqDDocInvoiceXrefStageByID:
create tQCrossCyDDocInvoiceXrefStage.
assign tQCrossCyDDocInvoiceXrefStage.DDocInvoiceXrefStage_ID = tqDDocInvoiceXrefStageByID.tiDDocInvoiceXrefStage_ID
tQCrossCyDDocInvoiceXrefStage.DDocInvoiceXrefStageAlloTC = tqDDocInvoiceXrefStageByID.tdDDocInvoiceXrefStageAlloTC
tQCrossCyDDocInvoiceXrefStage.DDocInvoiceXrefStageDiscTC = tqDDocInvoiceXrefStageByID.tdDDocInvoiceXrefStageDiscTC
tQCrossCyDDocInvoiceXrefStage.DDocumentInvoiceXref_ID = tqDDocInvoiceXrefStageByID.tiDDocumentInvoiceXref_ID
tQCrossCyDDocInvoiceXrefStage.tiDInvoice_ID = tQCrossyCyPostingDIMovement.tiDInvoiceId
tQCrossCyDDocInvoiceXrefStage.DInvoiceStage_ID = tqDDocInvoiceXrefStageByID.tiDInvoiceStage_ID
tQCrossCyDDocInvoiceXrefStage.tc_Status = "N":U
tQCrossCyDDocInvoiceXrefStage.tc_Rowid = string(tqDDocInvoiceXrefStageByID.tiDDocInvoiceXrefStage_ID).
end.
end.
<M-6 run CreateDInvoiceMovements
(input-output tQCrossyCyPostingDIMovement (tDIMovement),
input tQCrossCyDDocInvoiceXrefStage (tDInvoiceStageUpdates),
input-output viBJournalEntryQCrossCyPostID (biBJournalEntryId),
input no (ilClearData),
input today (itPaymentTaxPointDate),
output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave BlockTransaction.
/* ================================== */
/* validations and additional updates */
/* ================================== */
<M-3 run ValidateBCAndAdditionalUpdates (output viFcReturnSuper (oiReturnStatus)) in BDInvoice>
if viFcReturnSuper < 0
then do:
assign vcMsgCrossCy = trim(substitute(#T-7'Error &1 occurred when validating the customer invoice.':150(3458)T-7#, string(viFcReturnSuper)))
oiReturnStatus = viFcReturnSuper.
<M-4 run SetMessage (input vcMsgCrossCy (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1482':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BQCrossCyPosting>
end.
end. /* stop block */
/* ======================= */
/* close dinvoice instance */
/* ======================= */
<I-5 {bFcCloseInstance
&CLASS = "BDInvoice"}>