validation procedure
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bdpaymentselection.p)
/* update or create payment selection hader attributes */
for each t_sDPaySel where
t_sDPaySel.tc_Status <> "D":U,
each tDPaySelPayCodeRef where
tDPaySelPayCodeRef.tc_ParentRowid = t_sDPaySel.tc_Rowid:
/* find existing tPaySel record */
find first t_sDPaySelPayCode where
t_sDPaySelPayCode.PayFormatGroup_ID = tDPaySelPayCodeRef.PayFormatGroup_ID no-error.
/* if this is new header payment attribute, create it */
if not available t_sDPaySelPayCode
then do:
<M-91 run AddDetailLine
(input 'DPaySelPayCode':U (icTable),
input t_sDPaySel.tc_Rowid (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BDPaymentSelection>
create t_sDPaySelPayCode.
buffer-copy tDPaySelPayCode to t_sDPaySelPayCode.
end. /* if not available tPaySelPayCode */
/* update existing values */
buffer-copy tDPaySelPayCodeRef except DPaySel_ID DPaySelPayCode_ID tc_Rowid tc_ParentRowid tc_status to t_sDPaySelPayCode.
assign t_sDPaySelPayCode.DPaySelPayCodeValue = tDPaySelPayCodeRef.tcPayFormatCode
t_sDPaySelPayCode.tcPayFormatCode = tDPaySelPayCodeRef.tcPayFormatCode /*FIN_3198*/
t_sDPaySelPayCode.tc_Status = (if t_sDPaySelPayCode.tc_Status = "":U
then "C":U
else t_sDPaySelPayCode.tc_Status).
end.
/* delete those not used attributes */
if can-find(first tDPaySelPayCodeRef)
then do:
for each t_sDPaySelPayCode where
not can-find(first tDPaySelPayCodeRef where
tDPaySelPayCodeRef.PayFormatGroup_ID = t_sDPaySelPayCode.PayFormatGroup_ID):
assign t_sDPaySelPayCode.tc_Status = "D":U.
end.
end. /* then do */
/*
* Setup payment attribute value and payment format code ID as follows:
* If attribute value is blank set code ID to zero.
* If attribute value is not blank search for existing attribute value:
* If existing record found then assign code ID from found record
* If existing record not found then assign code ID to zero
*/
for each t_sDPaySelPayCode where
t_sDPaySelPayCode.tc_status = "N":U or
t_sDPaySelPayCode.tc_status = "C":U:
if t_sDPaySelPayCode.tcPayFormatCode <> ? and
t_sDPaySelPayCode.tcPayFormatCode <> "":U
then do:
<Q-88 run PayFormatCodebyGroupID (all) (Read) (NoCache)
(input ?, (PayFormatCodeID)
input t_sDPaySelPayCode.tcPayFormatCode, (PayFormatCode)
input t_sDPaySelPayCode.PayFormatGroup_ID, (PayFormatGroupID)
output dataset tqPayFormatCodebyGroupID) in BPaymentFormat>
find first tqPayFormatCodebyGroupID no-error.
if available tqPayFormatCodebyGroupID
then assign t_sDPaySelPayCode.PayFormatCode_ID = tqPayFormatCodebyGroupID.tiPayFormatCode_ID.
else assign t_sDPaySelPayCode.PayFormatCode_ID = 0.
end.
end.