project QadFinancials > class PGTM > method InitInstance

Description

Set the value of "vcDefaultMfgProgram" before the <ANCESTOR-CODE>.

This method is executed when a new instance of the business class is started, or when a draft instance is opened (in that case a new instance is started which is a copy of the draft instance).

PreCondition

This method is executed when a new instance of the business class is started, or when a draft instance is opened (in that case a new instance is started which is a copy of the draft instance).


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program/pgtm.p)

assign 
    vcDefaultMfgProgram = "gtmapi.p":U.

<ANCESTOR-CODE>

/* check which dataset to use in the api to operational code
    if the mfg version is equal or greater to 2014 then yes
    or if mfg version is equal or greater to 2013 and avatax is enabled then yes
 */

/* first check the mfgpro version */   
/* =================================== */
/* Check the version of the Mfg/Pro                  */
/* If the MfgPro version is EE2014 or higher       */
/* =================================== */
<M-2 run StartCacher
   (output vhFcComponent (ohCacher), 
    output viFcReturnSuper (oiReturnStatus)) in PGTM>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

<M-73 run GetIntegerValueFromSession
   (input  viSessionID (iiSessionId), 
    input  'MfgProMajorVersion' (icDataItemName), 
    output viMfgProMajorVersion (oiValue), 
    output viFcReturnSuper (oiReturnStatus)) in Cacher>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

<M-86 run GetIntegerValueFromSession
   (input  viSessionID (iiSessionId), 
    input  'MfgProMinorVersion' (icDataItemName), 
    output viMfgProMinorVersion (oiValue), 
    output viFcReturnSuper (oiReturnStatus)) in Cacher>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

<M-23 run GetLogicalValueFromSession
   (input  viSessionID (iiSessionId), 
    input  'AvataxIsActive' (icDataItemName), 
    output vlAvataxIsActive (olValue), 
    output viFcReturnSuper (oiReturnStatus)) in Cacher>
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

if viMfgProMajorVersion > 3 /* Meaning eB3 */ or 
   (viMfgProMajorVersion  = 3 /* Meaning eB3 */ and 
    viMfgProMinorVersion > 12 /* Meaning EE 2014 - SP12 */ ) or 
    vlAvataxIsActive = true 
then    
    assign vlUseExtendedTaxParams = true.
else
    assign vlUseExtendedTaxParams = false.    

/* ALSO NEED TO CHECK FOR EE2013  + AVATAX */