project QadFinancials > class BAPMatching > method GetPendingVouchers

Description

This method can be used to retrieve pending vouchers which fits all filtering criteria. Method is usually executed from user interface


Parameters


icAPMatchingTcRowidinputcharactericAPMatchingTcRowid: Rowid (converted to character) of the matching. This corresponds with field tAPMatching.tc_rowid.
icPendingVoucherTypeinputcharacterType of pending vocuher. See constants APMATCHINGPVOTYPE...
iiCInvoicePostingYearinputinteger
icCInvoiceJournalCodeinputcharacter
iiCInvoiceVoucherinputinteger
iiCInvoiceRegistrationNrinputintegerCInvoiceRegistrationNr
icCreditorCodeinputcharacter
ilIncludeEmptyCreditorsinputlogical
icCurrencyCodeinputcharacter
idCInvoiceTCLCRateinputdecimal
idCInvoiceTCLCScaleinputdecimal
idCInvoiceTCCCRateinputdecimal
idCInvoiceTCCCScaleinputdecimal
idCInvoiceTotalAmountTCinputdecimal
idCInvoiceARRecTaxTCinputdecimal
idCInvoiceARNRecTaxTCinputdecimal
itTransactionDateFrominputdate
itTransactionDateTillinputdate
itTransactionDetailDateFrominputdate
itTransactionDetailDateTillinputdate
icExternalReferenceFrominputcharacter
icExternalReferenceToinputcharacter
icInternalReferenceFrominputcharacter
icInternalReferenceToinputcharacter
icShipToFrominputcharacter
icShipToToinputcharacter
icItemNumberFrominputcharacter
icItemNumberToinputcharacter
icBuyerinputcharacter
icApprovedByinputcharacter
icLogisticChargeFrominputcharacter
icLogisticChargeToinputcharacter
icShipFromFrominputcharacter
icShipFromToinputcharacter
ilAutoSelectinputlogical
icPOShipperInvoiceinputcharacter
icOrderFrominputcharacter
icOrderToinputcharacter
ilCallGTMinputlogicalilCallGTM: Set to true in case you want this method to call GTM to recalculate the taxes. If false, then the taxes will just be taken from the pending-voucher
tOrderFilterAPMinputtemp-table
tPendingVoucherAPMoutputtemp-table
tPendingVoucherTaxAPMoutputtemp-table
tPendingVoucherWHTAPMoutputtemp-tabletemp-table that contains all wht records for the pending vouchers
tPendingVoucherHeaderoutputtemp-table
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program7/bapmatching.p)

/* ============================================================================ */
/* Method:  GetPendingVouchers                                                  */
/* Desc:    This method can be used to retrieve pending vouchers which fits all */
/*          filtering criteria. Method is usually executed from user interface  */
/* ============================================================================ */

/* ======================= */
/* Default return-status   */
/* ======================= */
assign oiReturnStatus = -98.

/* ========== */
/* Initialize */
/* ========== */
empty temp-table tPendingVoucherAPM.
empty temp-table tPendingVoucherTaxAPM.
empty temp-table tPendingVoucherHeader.
empty temp-table tPendingVoucherWHTAPM.

/* ====================================================================================== */
/* Check header record and its company; Validate the existance of the tAPMatching record: */
/* We need this to state the taxes as they differ per type (invoice / credit-note         */
/* ====================================================================================== */
Find tAPMatching where 
     tAPMatching.tc_Rowid = icAPMatchingTcRowid
     no-lock no-error.
if not available tAPMatching
then do :
    assign oiReturnStatus  = -3
           vcMsgAPMatching = trim(substitute(#T-19'Internal error: cannot find the Matching record based upon its rowid (&1).':255(68662)t-19#,icAPMatchingTcRowid)).
    <M-18 run SetMessage (input  vcMsgAPMatching (icMessage), 
                 input  '':U (icArguments), 
                 input  '':U (icFieldName), 
                 input  '':U (icFieldValue), 
                 input  'E':U (icType), 
                 input  3 (iiSeverity), 
                 input  '':U (icRowid), 
                 input  'QadFin-7705':U (icFcMsgNumber), 
                 input  '':U (icFcExplanation), 
                 input  '':U (icFcIdentification), 
                 input  '':U (icFcContext), 
                 output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
    Return.
end. /* if not available tAPMatching */
if tAPMatching.Company_ID <> viCompanyId
then do :
    assign oiReturnStatus  = -3
           vcMsgAPMatching = trim(substitute(#T-21'The system cannot calculate taxes because the entity used in the matching is not the current entity (&1)':255(68663)t-21#,vcCompanyCode)).
    <M-20 run SetMessage (input  vcMsgAPMatching (icMessage), 
                 input  '':U (icArguments), 
                 input  '':U (icFieldName), 
                 input  '':U (icFieldValue), 
                 input  'E':U (icType), 
                 input  3 (iiSeverity), 
                 input  '':U (icRowid), 
                 input  'QadFin-7706':U (icFcMsgNumber), 
                 input  '':U (icFcExplanation), 
                 input  '':U (icFcIdentification), 
                 input  '':U (icFcContext), 
                 output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
    Return.
end. /* if tAPMatching.Company_ID <> viCompanyId */

/* ======================================================================================================== */
/* Make sure the inst-dep class data-item 'ListAccessibleCompanyCodes' that holds the list of company-codes */
/* that can be accessed by the current user based on the 'entity-securoty' mechnaism of MfgPro.             */
/* This field can contain a comma-separated list of the CompanyCodes you have acces to the APMathcing.      */
/* If the value of this parameter is *, then this means you have acces to all companies of the domain.      */
/* ======================================================================================================== */
if vcListAccessibleCompanyCodes = ? or vcListAccessibleCompanyCodes = "?":U /* this means it was not yet filled */
then do : 
     <I-1 {bFcOpenInstance
          &CLASS           = "Session"}>
     <M-2 run GetCompanyListForUserAndDomain
        (input  vcUserLogin (icUserLogin), 
         input  viDomainID (iiDomainID), 
         output vcListAccessibleCompanyCodes (ocCompanyCodeList), 
         output viExternalReturnStatus (oiReturnStatus)) in Session>
     <I-3 {bFcCloseInstance
          &CLASS           = "Session"}>
    if viExternalReturnStatus <> 0 then assign oiReturnStatus = viFcReturnSuper.
    if viExternalReturnStatus <  0 then Return.
end. /* if vcListAccessibleCompanyCodes = ? */

/* ====================================== */
/* Normalize and validate input paramters */
/* ====================================== */
<M-4 run GetPendingVouchersValidate
   (input  icAPMatchingTcRowid (icAPMatchingTcRowid), 
    input  icPendingVoucherType (icPendingVoucherType), 
    input  iiCInvoicePostingYear (iiCInvoicePostingYear), 
    input  icCInvoiceJournalCode (icCInvoiceJournalCode), 
    input  iiCInvoiceVoucher (iiCInvoiceVoucher), 
    input  iiCInvoiceRegistrationNr (iiCInvoiceRegistrationNr), 
    input-output icCreditorCode (bcCreditorCode), 
    input-output icCurrencyCode (bcCurrencyCode), 
    input-output idCInvoiceTCLCRate (bdCInvoiceTCLCRate), 
    input-output idCInvoiceTCLCScale (bdCInvoiceTCLCScale), 
    input-output idCInvoiceTCCCRate (bdCInvoiceTCCCRate), 
    input-output idCInvoiceTCCCScale (bdCInvoiceTCCCScale), 
    input-output itTransactionDateFrom (btTransactionDateFrom), 
    input-output itTransactionDateTill (btTransactionDateTill), 
    input-output itTransactionDetailDateFrom (btTransactionDetailDateFrom), 
    input-output itTransactionDetailDateTill (btTransactionDetailDateTill), 
    input-output icExternalReferenceFrom (bcExternalReferenceFrom), 
    input-output icExternalReferenceTo (bcExternalReferenceTo), 
    input-output icInternalReferenceFrom (bcInternalReferenceFrom), 
    input-output icInternalReferenceTo (bcInternalReferenceTo), 
    input-output icShipToFrom (bcShipToFrom), 
    input-output icShipToTo (bcShipToTo), 
    input-output icItemNumberFrom (bcItemNumberFrom), 
    input-output icItemNumberTo (bcItemNumberTo), 
    input-output icBuyer (bcBuyer), 
    input-output icApprovedBy (bcApprovedBy), 
    input-output icLogisticChargeFrom (bcLogisticChargeFrom), 
    input-output icLogisticChargeTo (bcLogisticChargeTo), 
    input-output icShipFromFrom (bcShipFromFrom), 
    input-output icShipFromTo (bcShipFromTo), 
    input-output ilAutoSelect (blAutoSelect), 
    input-output icPOShipperInvoice (bcPOShipperInvoice), 
    input-output icOrderFrom (bcOrderFrom), 
    input-output icOrderTo (bcOrderTo), 
    input-output ilCallGTM (blCallGTM), 
    output vcExternalReference (ocExternalReference), 
    output vcInternalReference (ocInternalReference), 
    output vcShipFrom (ocShipFrom), 
    output vcShipTo (ocShipTo), 
    output vcItemNumber (ocItemNumber), 
    output vcLogisticCharge (ocLogisticCharge), 
    output vtTransactionDate (otTransactionDate), 
    output vtTransactionDetailDate (otTransactionDetailDate), 
    output vcOrder (ocOrder), 
    output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper <  0 then return.

/* ===================================== */
/* Create comma separated list of orders */
/* ===================================== */
assign vcOrderList = "":U.
for each tOrderFilterAPM where
         tOrderFilterAPM.tcPONbr <> "":U:
    if vcOrderList = "":U
    then assign vcOrderList = tOrderFilterAPM.tcPONbr.
    else if not can-do(vcOrderList, tOrderFilterAPM.tcPONbr)
         then assign vcOrderList = vcOrderList + ",":U + tOrderFilterAPM.tcPONbr.
end. /* for each tOrderFilterAPM wher */

/* =================================================================================================== */
/* Start frequently used queries                                                                       */
/* Start&Open BCosting - in a different transaction - as it is used in the block to call an            */
/* instance-less api-method. The classs will be Closed&Stopped after the block                         */
/* This is the most performing way to run an instance-less api-method repetitively in this loop        */
/* Start a block that cannot contain a Return-statement as BCosting needs to be stopped after the loop */
/* Use viLoopReturnStatus to catch errors from here onwards                                            */
/* =================================================================================================== */
<Q-10 run APMatchingLnByStatusPvod  (Start) in BAPMatching >
<I-11 {bFcStartAndOpenInstance
     &ADD-TO-TRANSACTION = "false"
     &CLASS              = "BMfgCosting"}>

/* =============== */                                                                
/* Start the block */
/* =============== */
MAJORRETRIEVALBLOCK : DO :
    
    /* ==================================================== */
    /* Part 1: Get Pending Vouchers without logistic charge */
    /* ==================================================== */
    if icPendingVoucherType = {&APMATCHINGPVOTYPE-PORECEIPT}
    then do:
        <M-5 run GetPendingVouchersNoLogCharges
           (input  icAPMatchingTcRowid (icAPMatchingTcRowid), 
            input  icCreditorCode (icCreditorCode), 
            input  idCInvoiceTCLCRate (idCInvoiceTCLCRate), 
            input  idCInvoiceTCLCScale (idCInvoiceTCLCScale), 
            input  idCInvoiceTCCCRate (idCInvoiceTCCCRate), 
            input  idCInvoiceTCCCScale (idCInvoiceTCCCScale), 
            input  icCurrencyCode (icCurrencyCode), 
            input  idCInvoiceTotalAmountTC (idCInvoiceTotalAmountTC), 
            input  idCInvoiceARRecTaxTC (idCInvoiceARRecTaxTC), 
            input  idCInvoiceARNRecTaxTC (idCInvoiceARNRecTaxTC), 
            input  itTransactionDateFrom (itTransactionDateFrom), 
            input  itTransactionDateTill (itTransactionDateTill), 
            input  vtTransactionDate (itTransactionDate), 
            input  itTransactionDetailDateFrom (itTransactionDetailDateFrom), 
            input  itTransactionDetailDateTill (itTransactionDetailDateTill), 
            input  vtTransactionDetailDate (itTransactionDetailDate), 
            input  icExternalReferenceFrom (icExternalReferenceFrom), 
            input  icExternalReferenceTo (icExternalReferenceTo), 
            input  vcExternalReference (icExternalReference), 
            input  icInternalReferenceFrom (icInternalReferenceFrom), 
            input  icInternalReferenceTo (icInternalReferenceTo), 
            input  vcInternalReference (icInternalReference), 
            input  icShipToFrom (icShipToFrom), 
            input  icShipToTo (icShipToTo), 
            input  vcShipTo (icShipTo), 
            input  icItemNumberFrom (icItemNumberFrom), 
            input  icItemNumberTo (icItemNumberTo), 
            input  vcItemNumber (icItemNumber), 
            input  icBuyer (icBuyer), 
            input  icApprovedBy (icApprovedBy), 
            input  icLogisticChargeFrom (icLogisticChargeFrom), 
            input  icLogisticChargeTo (icLogisticChargeTo), 
            input  vcLogisticCharge (icLogisticCharge), 
            input  icShipFromFrom (icShipFromFrom), 
            input  icShipFromTo (icShipFromTo), 
            input  vcShipFrom (icShipFrom), 
            input  ilAutoSelect (ilAutoSelect), 
            input  icPOShipperInvoice (icPOShipperInvoice), 
            input  vcOrderList (icOrderList), 
            input  ilCallGTM (ilCallGTM), 
            input  ? (iiApiPvodID), 
            input  ? (iiApiPvodLineId), 
            input  ? (idApiMatchUnitPrice), 
            input  0 (idApiMatchQty), 
            input  ? (ilApiIsPvodFinished), 
            output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
        if viFcReturnSuper <> 0 then assign viBlockReturnStatus = viFcReturnSuper.
        if viFcReturnSuper <  0 then leave MAJORRETRIEVALBLOCK.
    end. /* if icPOShipperInvoice = "":U */
    
    /* ==================================================== */
    /* Part 2: Get Pending Vouchers with logistic charge    */
    /* ==================================================== */
    if icPendingVoucherType = {&APMATCHINGPVOTYPE-LOGCHARGE}
    then do:
        <M-6 run GetPendingVouchersLogCharges
           (input  icAPMatchingTcRowid (icAPMatchingTcRowid), 
            input  icCreditorCode (icCreditorCode), 
            input  ilIncludeEmptyCreditors (ilIncludeEmptyCreditors), 
            input  icCurrencyCode (icCurrencyCode), 
            input  idCInvoiceTCLCRate (idCInvoiceTCLCRate), 
            input  idCInvoiceTCLCScale (idCInvoiceTCLCScale), 
            input  idCInvoiceTCCCRate (idCInvoiceTCCCRate), 
            input  idCInvoiceTCCCScale (idCInvoiceTCCCScale), 
            input  idCInvoiceTotalAmountTC (idCInvoiceTotalAmountTC), 
            input  idCInvoiceARRecTaxTC (idCInvoiceARRecTaxTC), 
            input  idCInvoiceARNRecTaxTC (idCInvoiceARNRecTaxTC), 
            input  itTransactionDateFrom (itTransactionDateFrom), 
            input  itTransactionDateTill (itTransactionDateTill), 
            input  vtTransactionDate (itTransactionDate), 
            input  itTransactionDetailDateFrom (itTransactionDetailDateFrom), 
            input  itTransactionDetailDateTill (itTransactionDetailDateTill), 
            input  vtTransactionDetailDate (itTransactionDetailDate), 
            input  icExternalReferenceFrom (icExternalReferenceFrom), 
            input  icExternalReferenceTo (icExternalReferenceTo), 
            input  vcExternalReference (icExternalReference), 
            input  icInternalReferenceFrom (icInternalReferenceFrom), 
            input  icInternalReferenceTo (icInternalReferenceTo), 
            input  vcInternalReference (icInternalReference), 
            input  icShipToFrom (icShipToFrom), 
            input  icShipToTo (icShipToTo), 
            input  vcShipTo (icShipTo), 
            input  icItemNumberFrom (icItemNumberFrom), 
            input  icItemNumberTo (icItemNumberTo), 
            input  vcItemNumber (icItemNumber), 
            input  icLogisticChargeFrom (icLogisticChargeFrom), 
            input  icLogisticChargeTo (icLogisticChargeTo), 
            input  vcLogisticCharge (icLogisticCharge), 
            input  icShipFromFrom (icShipFromFrom), 
            input  icShipFromTo (icShipFromTo), 
            input  vcShipFrom (icShipFrom), 
            input  ilAutoSelect (ilAutoSelect), 
            input  icOrderFrom (icOrderFrom), 
            input  icOrderTo (icOrderTo), 
            input  vcOrder (icOrder), 
            input  ilCallGTM (ilCallGTM), 
            input  ? (iiApiPvoId), 
            input  ? (iiApiPvodLineId), 
            input  ? (idApiMatchAmtTC), 
            input  ? (ilApiIsPvodFinished), 
            output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
        if viFcReturnSuper <> 0 then assign viBlockReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0 then leave MAJORRETRIEVALBLOCK.
    end. /* if ilIncludeLogisticCharge and */        
    
    /* ============================================================= */
    /* Part 3: Get Pending Vouchers linked to Purchase Order Shipper */
    /* ============================================================= */
    if icPendingVoucherType = {&APMATCHINGPVOTYPE-POSHIPPER}
    then do:
        <M-7 run GetPendingVouchersPOShipper
           (input  icAPMatchingTcRowid (icAPMatchingTcRowid), 
            input  icPOShipperInvoice (icPOShipperInvoice), 
            input  icCreditorCode (icSupplier), 
            input  ilAutoSelect (ilAutoSelect), 
            input  idCInvoiceTCLCRate (idCInvoiceTCLCRate), 
            input  idCInvoiceTCLCScale (idCInvoiceTCLCScale), 
            input  idCInvoiceTCCCRate (idCInvoiceTCCCRate), 
            input  idCInvoiceTCCCScale (idCInvoiceTCCCScale), 
            input  idCInvoiceTotalAmountTC (idCInvoiceTotalAmountTC), 
            input  idCInvoiceARRecTaxTC (idCInvoiceARRecTaxTC), 
            input  idCInvoiceARNRecTaxTC (idCInvoiceARNRecTaxTC), 
            input  ilCallGTM (ilCallGTM), 
            output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
        if viFcReturnSuper <> 0 then assign viBlockReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0 then leave MAJORRETRIEVALBLOCK.
    end. /* if icPOShipperInvoice <> '':U */
    
    /* ======================================================================================================== */
    /* Call GTM when needed - if not needed then the tax-details are already created by one of the 3 submethods */
    /* ======================================================================================================== */
    if ilCallGTM = true 
    then do :
        /* =================== */
        /* Open assess to PGTM */
        /* =================== */
        <I-12 {bFcStartAndOpenInstance
             &ADD-TO-TRANSACTION = "false"
             &CLASS              = "PGTM"}>
        /* ==================================================================================== */
        /* Go through all created tPendingVoucherAPM records - equivalent for the tAPMatchingLn */
        /* ==================================================================================== */
        PGTMCALLINGBLOCK : DO :
            for each tPendingVoucherAPM where 
                     tPendingVoucherAPM.APMatchingLnIsTaxable  = true and 
                     tPendingVoucherAPM.APMatchingLnTaxEnv    <> "":U and 
                     tPendingVoucherAPM.APMatchingLnTaxEnv    <> ?
                     no-lock :
                <M-14 run CreateAPMatchingLNTaxFromGTM
                   (input  icAPMatchingTcRowid (icAPMatchingTcRowid), 
                    input  tPendingVoucherAPM.tc_Rowid (icAPMatchingLnTcRowid), 
                    input  icCurrencyCode (icCurrencyCode), 
                    input  '':U (icTransactionType), 
                    input  iiCInvoiceVoucher (icDocumentReference), 
                    input  '':U (icDocumentNumber), 
                    input  tPendingVoucherAPM.APMatchingLnIsTaxable (ilIsTaxable), 
                    input  False (ilIsTaxIncludedInTheAmount), 
                    input  tAPMatching.ttCInvoiceTaxPointDate (itTaxPointDate), 
                    input  tAPMatching.APMatchingDate (itPostingDate), 
                    input  tPendingVoucherAPM.APMatchingLnTaxEnv (icTaxEnvCode), 
                    input  tPendingVoucherAPM.APMatchingLnPvodFromTaxZone (icFromTaxZoneCode), 
                    input  tPendingVoucherAPM.APMatchingLnPvodToTaxZone (icToTaxZoneCode), 
                    input  tPendingVoucherAPM.APMatchingLnTaxClass (icTaxClassCode), 
                    input  tPendingVoucherAPM.APMatchingLnTaxUsage (icTaxUsageCode), 
                    input  tPendingVoucherAPM.APMatchingLnMatchAmtTC (idAmountTC), 
                    input  idCInvoiceTCLCRate (idCInvoiceTCLCRate), 
                    input  idCInvoiceTCLCScale (idCInvoiceTCLCScale), 
                    input  idCInvoiceTCCCRate (idCInvoiceTCCCRate), 
                    input  idCInvoiceTCCCScale (idCInvoiceTCCCScale), 
                    input  vcCompanyCode (icCompanyCode), 
                    input  1 (idAdjustmentFactor), 
                    input  tAPMatching.APMatchingCInvoiceDiscPct (idPaymentConditionPercentage), 
                    input  tAPMatching.tlCreditorAddrIsTaxInCity (ilIsTaxInCityOfShipTo), 
                    input  tAPMatching.tlShipToAddrIsTaxInCity (ilIsTaxInCityOfShipFrom), 
                    input  False (ilNeedToStartPGTMFromHere), 
                    output tAPMatchingLnTaxFromGTM (tAPMatchingLnTaxFromGTM), 
                    output tAPMatchingLnWHTFromGTM (tAPMatchingLnWHTFromGTM), 
                    output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
                if viFcReturnSuper <> 0 then assign viPGTMBlockReturnStatus = viFcReturnSuper.
                if viFcReturnSuper <  0 then leave PGTMCALLINGBLOCK.
                /* =================================================================================================================================== */
                /* Store the output in the tPendingVoucherTaxAPM - equivalent for tAPMatchingLnTax and empty tAPMatchingLnTaxFromGTM when it is copied */
                /* =================================================================================================================================== */
                for each tAPMatchingLnTaxFromGTM :
                    create tPendingVoucherTaxAPM.
                    buffer-copy tAPMatchingLnTaxFromGTM to tPendingVoucherTaxAPM.
                end. /* for each tAPMatchingLnTaxFromGTM */
                empty temp-table tAPMatchingLnTaxFromGTM.
                /* =================================================================================================================================== */
                /* Store the output in the tPendingVoucherWHTAPM - equivalent for tAPMatchingLnWHT and empty tAPMatchingLnWHTFromGTM when it is copied */
                /* =================================================================================================================================== */
                for each tAPMatchingLnWHTFromGTM :
                    create tPendingVoucherWHTAPM.
                    buffer-copy tAPMatchingLnWHTFromGTM to tPendingVoucherWHTAPM.
                end. /* for each tAPMatchingLnWHTFromGTM */
                empty temp-table tAPMatchingLnWHTFromGTM.
            End. /* for each tPendingVoucherAPM */
        END. /* PGTMCALLINGBLOCK */
        /* ======================================= */
        /* Close access to PGTM & check for errors */
        /* ======================================= */
        <I-13 {bFcCloseAndStopInstance
             &CLASS           = "PGTM"}>
        if viPGTMBlockReturnStatus <> 0 then assign viBlockReturnStatus = viPGTMBlockReturnStatus.
        if viPGTMBlockReturnStatus <  0 then leave MAJORRETRIEVALBLOCK.
        
    end. /* if ilCallGTM = true  */
    
END. /* MAJORRETRIEVALBLOCK */

/* ======================================== */
/* End BCosting as it was used in the block */
/* Check for errors in the block            */
/* Stop frequently used queries             */
/* ======================================== */
<Q-9 run APMatchingLnByStatusPvod  (Stop) in BAPMatching >
<I-8 {bFcCloseAndStopInstance
     &CLASS           = "BMfgCosting"}>
assign vlBMfgCostingStart = false.
if viBlockReturnStatus <> 0 then assign oiReturnStatus = viBlockReturnStatus.
if viBlockReturnStatus < 0 then Return.

/* ====================== */
/* Default return-status  */
/* ====================== */
if oiReturnStatus = -98 then assign oiReturnStatus = 0.