Parameters
ilEndUserAddressDelete | input | logical | |
iiAddressID | input | integer | |
ilShiptoAddressDelete | input | logical | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bbusinessrelation.p)
/* If we can delete end users then we need to be verify the address is not in use */
if ilEndUserAddressDelete <> true
then do:
<Q-1 run DebtorEndUserByAddress (all) (Read) (NoCache)
(input viCompanyID, (CompanyId)
input iiAddressID, (AddressID)
output dataset tqDebtorEndUserByAddress) in BDebtorEndUser >
for each tqDebtorEndUserByAddress:
assign
oiReturnStatus = -1
vcMessageTxt = #T-7'You cannot delete the address. It is used by end user $1.':60(63357)t-7#.
<M-2 run SetMessage
(input vcMessageTxt (icMessage),
input tqDebtorEndUserByAddress.tcDebtorEndUserCode (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'QadFin-6508':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBusinessRelation>
end.
end. /*end can't delete end users */
if ilShiptoAddressDelete <> true
then do:
<Q-12 run DebtorShiptoByAddress (all) (Read) (NoCache)
(input viCompanyID, (CompanyId)
input iiAddressID, (AddressID)
output dataset tqDebtorShiptoByAddress) in BDebtorShipTo >
for each tqDebtorShiptoByAddress:
assign
oiReturnStatus = -1
vcMessageTxt = #T-11'You cannot delete the address. It is used by ship-to $1.':60(63601)t-11#.
<M-10 run SetMessage
(input vcMessageTxt (icMessage),
input tqDebtorShiptoByAddress.tcDebtorShiptoCode (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'QadFin-6530':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBusinessRelation>
end.
end. /*end can't delete end users */
/* verify no other ad_mstr address records exist */
<Q-3 run AddressByFinancialAddress (all) (Read) (NoCache)
(input iiAddressID, (AddressID)
output dataset tqAddressByFinancialAddress) in BMfgAddress >
for each tqAddressByFinancialAddress:
if tqAddressByFinancialAddress.tcad_type <> {&ADDRESSTYPECODESYSTEM-ENDUSER} and
tqAddressByFinancialAddress.tcad_type <> {&ADDRESSTYPECODESYSTEM-DELIVERY}
then do:
assign
oiReturnStatus = -1
vcMessageTxt = #T-8'You cannot delete the address. It is used by address $1 (type $2).':60(63371)t-8#.
<M-4 run SetMessage
(input vcMessageTxt (icMessage),
input tqAddressByFinancialAddress.tcad_addr + chr(2) + tqAddressByFinancialAddress.tcad_type (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'QadFin-6509':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBusinessRelation>
end.
end. /* End of for each ad_mstr address */