project QadFinancials > class BDeductionCat > method DeductionCatIsUsed


Parameters


icDeductionCatCodeinputcharacter
olIsUsedoutputlogical
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDeductionCat.ApiDeductionCatIsUsed
method BDeductionCat.ValidateComponent


program code (program1/bdeductioncat.p)

/********************************************************************************/
/* Check if the deduction category already been used */
/********************************************************************************/
assign olIsUsed = no.
if icDeductionCatCode = ? or icDeductionCatCode = '':U
then return.

/* get all deductioncatline ids under input deductioncatcode */
<Q-75 run GetDedCatLineIdByDedCatCode (all) (Read) (NoCache)
   (input icDeductionCatCode, (DeductionCatCode)
    output dataset tqGetDedCatLineIdByDedCatCode) in BDeductionCat>
for each tqGetDedCatLineIdByDedCatCode no-lock:
    /* call a query in BDInvoice to check if this deductioncatlineid has been used */
    <Q-32 run DInvoiceDeductionByCatLineId (all) (Read) (NoCache)
       (input tqGetDedCatLineIdByDedCatCode.tiDeductionCatLine_ID, (DeductionCatLineId)
        output dataset tqDInvoiceDeductionByCatLineId) in BDInvoice>
    find first tqDInvoiceDeductionByCatLineId no-error.
    if available tqDInvoiceDeductionByCatLineId
    then do:
        olIsUsed = yes.
        leave.
    end.
end.

assign oiReturnStatus = 0.