project QadFinancials > class BDebtor > method ValInvControlGLProfile
Description
Validates Creditor Control Account for Invoices.
Note: work with t_s tables in here
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bdebtor.p)
/*error: Profile must exist - checked by FC*/
/*error: Profile must be of certain type*/
if t_sDebtor.InvControlGLProfile_ID <> 0 and t_sDebtor.InvControlGLProfile_ID <> ? and
(t_sDebtor.tc_Status = "N":U or
(t_sDebtor.tc_Status = "C" and
can-find (t_iDebtor where
t_iDebtor.tc_Rowid = t_sDebtor.tc_Rowid and
t_iDebtor.InvControlGLProfile_ID <> t_sDebtor.InvControlGLProfile_ID )))
then do:
<Q-6 run ProfileById (all) (Read) (Cache)
(input t_sDebtor.InvControlGLProfile_ID, (Profile_ID)
output dataset tqProfileById) in BProfile>
find first tqProfileById no-error.
if available tqProfileById and
tqProfileById.tcProfileTypeCode <> {&PROFILETYPECODE-DEBTORACCOUNT}
then do:
assign vcMessage = trim(substitute(#T-9'The customer control account profile (invoice) &1 is not of type &2 for customer &3.':200(1687)t-9#,
trim(tqProfileById.tcProfileCode),
trim({&PROFILETYPECODE-DEBTORACCOUNT-TR}),
trim(t_sDebtor.DebtorCode))) + chr(10) +
program-name(1)
oiReturnStatus = -1.
<M-7 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tDebtor.tcInvControlGLProfileCode':U (icFieldName),
input t_sDebtor.tcInvControlGLProfileCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sDebtor.tc_Rowid (icRowid),
input 'QADFIN-313':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDebtor>
end.
/*error: if > 0 and exists then should be active*/
if available tqProfileById and
tqProfileById.tcProfileTypeCode = {&PROFILETYPECODE-DEBTORACCOUNT} and
not tqProfileById.tlProfileIsActive
then do:
assign vcMessage = trim(substitute(#T-10'The customer control account profile (invoice) &1 is not active for customer &2.':200(1688)t-10#,
trim(tqProfileById.tcProfileCode),
trim(t_sDebtor.DebtorCode))) + chr(10) +
program-name(1)
oiReturnStatus = -1.
<M-8 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input 'tDebtor.tcInvControlGLProfileCode':U (icFieldName),
input t_sDebtor.tcInvControlGLProfileCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sDebtor.tc_Rowid (icRowid),
input 'QADFIN-314':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BDebtor>
end.
end.