project QadFinancials > class BMfgCreditTerms > method MaintainData

Description

Procedure that controls the Create/Update/Delete operations on the ct_mstr record in MfgPro.


Parameters


tCopyPaymentConditioninputtemp-tableTemp table instance that contains the data from the financials that is being synchronized with MFG/PRO.
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BPaymentCondition.AdditionalUpdates


program code (program1/bmfgcreditterms.p)

/* ====================================================== */
/* Set the return status to unexpected system error (-98) */
/* ====================================================== */
assign oiReturnStatus = -98.

/* =============================================================================================== */
/* Execute the ProcessMaintainData method to execute the generic processing of the update in the   */
/* Financials across to the MFG/PRO database. (this method can be called from within a Loop)       */
/* First: clear the instance                                                                       */
/* Last: call ProcessMaintainDataSave to save the data                                             */
/* =============================================================================================== */
<M-1 run ClearData (output viFcReturnSuper (oiReturnStatus)) in BMfgCreditTerms>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then Return.
<Q-5 run DomainsForName (all) (Read) (NoCache)
   (output dataset tqDomainsForName) in BDomain >

/* Check if we need to replicate to one domain or to all */  
/* This variable could be set in BPayment.ApiReplicateFromDaemon */
<I-6 {bFcOpenInstance
            &CLASS           = "Session"}>                           
<M-7 run GetCharacterValue
   (input  'SystemwideToMFGDomainCode':U (icName), 
    output vcSystemwideToMFGDomain (ocValue), 
    output viSessionReturnStatus (oiReturnStatus)) in Session>
<I-8 {bFcCloseInstance
            &CLASS           = "Session"}>    
if viSessionReturnStatus <> 0
then assign oiReturnStatus = viSessionReturnStatus.
if viSessionReturnStatus < 0
then return.
                        
for each tqDomainsForName where
         tqDomainsForName.tlDomainPropertyIsSetupCompl = true:    
    if vcSystemwideToMFGDomain       <> '':U and
       vcSystemwideToMFGDomain       <> ?    and
       tqDomainsForName.tcDomainCode <> vcSystemwideToMFGDomain
    then next.
    
    /* save the domain code which is currently being processed */
    assign vcCreditTermDomain = tqDomainsForName.tcDomainCode.       
    <M-2 run ProcessMaintainData (output viFcReturnSuper (oiReturnStatus)) in BMfgCreditTerms>        
    if viFcReturnSuper <> 0 
    then assign oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0 
    then Return.
end. /* end of for each tqSelectDomainsForName... */

<M-3 run ProcessMaintainDataSave (output viFcReturnSuper (oiReturnStatus)) in BMfgCreditTerms>    
if viFcReturnSuper <> 0 
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 
then Return.
    
/* ======================== */
/* Set ReturnStatus = OK    */
/* ======================== */
if oiReturnStatus = -98
then assign oiReturnStatus = 0.