project QadFinancials > class BBankNumber > method ApiStdMaintainTTDetail
Description
With this method a Bank Number can be added, modified or deleted. detailed method of ApiStdMainTT.
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 (program9/bbanknumber.p)
/* =============================================== */
/* Go through all BankNumberPayCodes of BankNumber */
/* =============================================== */
for each tApiBankNumberPayCode where
tApiBankNumberPayCode.tc_ParentRowid = tApiBankNumber.tc_Rowid
by tApiBankNumberPayCode.tc_Rowid:
/* ==================================== */
/* Find the appropriate exsiting record */
/* ==================================== */
find tBankNumberPayCode where
tBankNumberPayCode.tc_ParentRowid = tBankNumber.tc_Rowid and
tBankNumberPayCode.tcPayFormatGroupCode = tApiBankNumberPayCode.tcPayFormatGroupCode
no-error.
if not available tBankNumberPayCode
then find tBankNumberPayCode where
tBankNumberPayCode.tc_ParentRowid = tBankNumber.tc_Rowid and
tBankNumberPayCode.BankNumberPayCode_ID = tApiBankNumberPayCode.BankNumberPayCode_ID
no-error.
/* ================================= */
/* Check for Create / Update */
/* ================================= */
if available tBankNumberPayCode
then do:
assign tBankNumberPayCode.tc_Status = "":U.
buffer-compare tApiBankNumberPayCode except
BankNumberPayCode_ID
BankNumber_ID
tc_Rowid
tc_ParentRowid
tc_status
to tBankNumberPayCode save vlBufferCompareResult.
if vlBufferCompareResult = true
then next.
assign tBankNumberPayCode.tc_Status = "C":U.
end. /* if available tBankNumberPayCode */
else do:
<M-3 run AddDetailLine
(input 'BankNumberPayCode':U (icTable),
input tBankNumber.tc_Rowid (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BBankNumber>
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 tBankNumberPayCode */
buffer-copy tApiBankNumberPayCode except
BankNumberPayCode_ID
BankNumber_ID
tc_Rowid
tc_ParentRowid
tc_Status
to tBankNumberPayCode.
/* Payment format related fields */
assign tBankNumberPayCode.tcPayFormatTypeCode = tBankNumber.tcPayFormatTypeCode.
/* retrieve pay format group ID */
if tBankNumberPayCode.tcPayFormatGroupCode <> ? and
tBankNumberPayCode.tcPayFormatGroupCode <> "":U and
(tBankNumberPayCode.PayFormatGroup_ID = ? or
tBankNumberPayCode.PayFormatGroup_ID = 0)
then do:
<Q-4 run PayFormatTypeForGroup (all) (Read) (NoCache)
(input tBankNumberPayCode.tcPayFormatTypeCode, (PayFormatTypeCode)
input tBankNumberPayCode.tcPayFormatGroupCode, (PayFormatGroupCode)
output dataset tqPayFormatTypeForGroup) in BPaymentFormat >
find first tqPayFormatTypeForGroup where
tqPayFormatTypeForGroup.tcPayFormatTypeCode = tBankNumberPayCode.tcPayFormatTypeCode and
tqPayFormatTypeForGroup.tcPayFormatGroupCode = tBankNumberPayCode.tcPayFormatGroupCode no-error.
if available tqPayFormatTypeForGroup
then assign tBankNumberPayCode.PayFormatGroup_ID = tqPayFormatTypeForGroup.tiPayFormatGroup_ID
tBankNumberPayCode.BankNumberPayCodeSequence = tqPayFormatTypeForGroup.tiPayFormatGroupSequence.
end.
/* retrieve pay format code related fields */
if tBankNumberPayCode.BankNumberPayCodeValue = ? or
tBankNumberPayCode.BankNumberPayCodeValue = "":U
then assign tBankNumberPayCode.PayFormatCode_ID = ?
tBankNumberPayCode.tcPayFormatCode = "":U
tBankNumberPayCode.tcPayFormatCodeDescription = "":U
tBankNumberPayCode.tcPayFormatCodeValue = "":U.
else do:
if tBankNumberPayCode.PayFormatGroup_ID <> ? and
tBankNumberPayCode.PayFormatGroup_ID <> 0 and
tBankNumberPayCode.BankNumberPayCodeValue <> ? and
tBankNumberPayCode.BankNumberPayCodeValue <> "":U
then do:
<Q-5 run PayFormatCodebyGroupID (all) (Read) (NoCache)
(input tBankNumberPayCode.PayFormatCode_ID, (PayFormatCodeID)
input tBankNumberPayCode.BankNumberPayCodeValue, (PayFormatCode)
input tBankNumberPayCode.PayFormatGroup_ID, (PayFormatGroupID)
output dataset tqPayFormatCodebyGroupID) in BPaymentFormat >
find first tqPayFormatCodebyGroupID where
tqPayFormatCodebyGroupID.tcPayFormatCode = tBankNumberPayCode.BankNumberPayCodeValue and
tqPayFormatCodebyGroupID.tiPayFormatGroup_ID = tBankNumberPayCode.PayFormatGroup_ID no-error.
if available tqPayFormatCodebyGroupID
then assign tBankNumberPayCode.PayFormatCode_ID = tqPayFormatCodebyGroupID.tiPayFormatCode_ID
tBankNumberPayCode.tcPayFormatCode = tqPayFormatCodebyGroupID.tcPayFormatCode
tBankNumberPayCode.tcPayFormatCodeDescription = tqPayFormatCodebyGroupID.tcPayFormatCodeDescription
tBankNumberPayCode.tcPayFormatCodeValue = tqPayFormatCodebyGroupID.tcPayFormatCode.
end. /* if tBankNumberPayCode.PayFormatGroup_ID <> ? and */
end. /* if tBankNumberPayCode.BankNumberPayCodeValue = ? or */
end. /* for each tApiBankNumberPayCode where ... */
/* ========================================================= */
/* Remove no longer used BankNumberPayCodes of BankNumber */
/* ========================================================= */
for each tBankNumberPayCode where
tBankNumberPayCode.tc_ParentRowid = tBankNumber.tc_Rowid and
tBankNumberPayCode.tc_Status = "":U:
/* Check if the record still exists */
find first tApiBankNumberPayCode where
tApiBankNumberPayCode.tc_ParentRowid = tApiBankNumber.tc_Rowid and
tApiBankNumberPayCode.BankNumberPayCode_ID = tBankNumberPayCode.BankNumberPayCode_ID
no-error.
if not available tApiBankNumberPayCode
then find first tApiBankNumberPayCode where
tApiBankNumberPayCode.tc_ParentRowid = tApiBankNumber.tc_Rowid and
tApiBankNumberPayCode.tcPayFormatTypeCode = tBankNumberPayCode.tcPayFormatTypeCode and
tApiBankNumberPayCode.tcPayFormatGroupCode = tBankNumberPayCode.tcPayFormatGroupCode
no-error.
if not available tApiBankNumberPayCode
then assign tBankNumberPayCode.tc_Status = "D":U.
end. /* for each tApiBankNumberPayCode where ... */