Parameters
icAction | input | character | |
bcLstReturn | input-output | character | |
bcLstPrimKey | input-output | character | |
bcLstRowId | input-output | character | |
blSaveAsDraft | input-output | logical | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program7/bpaymentcondition.p)
/*==========================================================*/
/* create/modify PaymentConditionStaged records */
/*==========================================================*/
for each tApiPaymentConditionStaged where
tApiPaymentConditionStaged.tc_ParentRowid = tApiPaymentCondition.tc_Rowid
by tApiPaymentConditionStaged.tc_Rowid :
/* ==================================== */
/* Find the appropriate exsiting record */
/* ==================================== */
find tPaymentConditionStaged where
tPaymentConditionStaged.tc_ParentRowid = tPaymentCondition.tc_Rowid and
tPaymentConditionStaged.PaymentConditionStaged_ID = tApiPaymentConditionStaged.PaymentConditionStaged_ID
no-error.
/* ================================= */
/* Check for Create / Update */
/* ================================= */
if available tPaymentConditionStaged
then do:
assign tPaymentConditionStaged.tc_Status = '':U.
buffer-compare tApiPaymentConditionStaged except
PaymentConditionStaged_ID
PaymentCondition_ID
tc_Rowid
tc_ParentRowid
tc_Status
to tPaymentConditionStaged save vlBufferCompareResult.
if vlBufferCompareResult = true
then next.
assign tPaymentConditionStaged.tc_Status = 'C':U.
end. /* if available tPaymentConditionStaged */
else do:
<M-1 run AddDetailLine
(input 'PaymentConditionStaged':U (icTable),
input tPaymentCondition.tc_Rowid (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BPaymentCondition>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then do:
assign blSaveAsDraft = (icAction <> {&DAEMONACTION-SAVE} and icAction <> {&DAEMONACTION-VALIDATE})
bcLstReturn = bcLstReturn + chr(4) + string(viFcReturnSuper)
bcLstPrimKey = bcLstPrimKey + chr(4) + "*":U
bcLstRowid = bcLstRowid + chr(4) + "*":U.
return.
end. /* if oiReturnStatus < 0 */
end. /* if viFcReturnSuper <> 0 */
end. /* NOT if available tPaymentConditionStaged */
buffer-copy tApiPaymentConditionStaged except
PaymentConditionStaged_ID
PaymentCondition_ID
tc_Rowid
tc_ParentRowid
tc_Status
to tPaymentConditionStaged.
end. /* for each tApiPaymentConditionStaged where */
/* =============================================== */
/* Remove the longer used Vatformat of the Saf */
/* =============================================== */
for each tPaymentConditionStaged where
tPaymentConditionStaged.tc_ParentRowid = tPaymentCondition.tc_Rowid :
/* Check if the record still exists */
find first tApiPaymentConditionStaged where
tApiPaymentConditionStaged.tc_ParentRowid = tApiPaymentCondition.tc_Rowid AND
tApiPaymentConditionStaged.PaymentConditionStaged_ID = tPaymentConditionStaged.PaymentConditionStaged_ID
no-error.
if not available tApiPaymentConditionStaged
then if tPaymentConditionStaged.tc_Status = "N":U
then delete tPaymentConditionStaged.
else assign tPaymentConditionStaged.tc_Status = "D":U.
end. /* for each tApiPaymentConditionStaged where ... */