project QadFinancials > class BBankEntry > method CalculateBankStateStageAlloc
Description
Calculate additional details about staged payments
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bbankentry.p)
/* =================================================================================================== */
/* Method : CalculateBankStateStageAlloc */
/* Desc : This method calculates values of calculated fields */
/* --------------------------------------------------------------------------------------------------- */
/* Params: (I) Name Description */
/* (O) Name Description */
/* =================================================================================================== */
assign oiReturnStatus = -98
viLocalReturn = 0.
/* =================================================================================================== */
/* Validate input parameters */
/* =================================================================================================== */
if not available tBankStateAlloc
then do:
assign vcMessage = #T-6'Banking Entry Allocation record not available':255(20656375)T-6#.
<M-32 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-119302':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
assign oiReturnStatus = -1.
return.
end.
/* =================================================================================================== */
/* Go through all stages and overtake values from invoice */
/* =================================================================================================== */
for each tBankStateStageAlloc where
tBankStateStageAlloc.tc_ParentRowid = tBankStateAlloc.tc_Rowid:
/* Get Stage details from Supplier invoice */
if tBankStateStageAlloc.CInvoiceStage_ID <> ? and
tBankStateStageAlloc.CInvoiceStage_ID <> 0
then do:
<Q-69 run CinvoiceStageByID (all) (Read) (NoCache)
(input tBankStateStageAlloc.CInvoiceStage_ID, (CinvoiceStageID)
output dataset tqCinvoiceStageByID) in BCInvoice >
find first tqCinvoiceStageByID where
tqCinvoiceStageByID.tiCInvoiceStage_ID = tBankStateStageAlloc.CInvoiceStage_ID
no-error.
if available tqCinvoiceStageByID
then assign tBankStateStageAlloc.ttDefaultDueDate = tqCinvoiceStageByID.ttCInvoiceStageDueDate
tBankStateStageAlloc.ttDefaultDiscDate = tqCinvoiceStageByID.ttCInvoiceStageDiscDate.
end. /* if tBankStateStageAlloc.CInvoiceStage_ID <> ? and */
/* Get Stage details from Customer invoice */
if tBankStateStageAlloc.DInvoiceStage_ID <> ? and
tBankStateStageAlloc.DInvoiceStage_ID <> 0
then do:
<Q-20 run DInvoiceStageByID (all) (Read) (NoCache)
(input tBankStateStageAlloc.DInvoiceStage_ID, (DInvoiceStageID)
output dataset tqDInvoiceStageByID) in BDInvoice >
find first tqDInvoiceStageByID where
tqDInvoiceStageByID.tiDInvoiceStage_ID = tBankStateStageAlloc.DInvoiceStage_ID
no-error.
if available tqDInvoiceStageByID
then assign tBankStateStageAlloc.ttDefaultDueDate = tqDInvoiceStageByID.ttDInvoiceStageDueDate
tBankStateStageAlloc.ttDefaultDiscDate = tqDInvoiceStageByID.ttDInvoiceStageDiscDate.
end. /* if tBankStateStageAlloc.DInvoiceStage_ID <> ? and */
end. /* for each tBankStateStageAlloc where */
if viFcReturnSuper < 0 or
viFcReturnSuper > 0 and viLocalReturn = 0
then assign viLocalReturn = viFcReturnSuper.
if viFcReturnSuper < 0
then do:
assign oiReturnStatus = viFcReturnSuper.
return.
end.
/* =================================================================================================== */
/* Return */
/* =================================================================================================== */
assign oiReturnStatus = viLocalReturn.