Description
Controls the processing of any update logic that is required when performing a create/modfiy operation on an MFG/PRO business component.
KEEP THE ANCESTOR TAG IN THE DESCENDANTS TO AVOID SCOPING PROBLEMS ON THE RECORD-AVAILABILITY
This method is the place holder for nay update ligic and complex mapping from the financials table to MFG/PRO.
Parameters
icMfgTableName | input | character | Name of the MFG/PRO table name that is currently being processed. This is used to determine which logic to execute within the method in the cases where one business component maps to multiple tables in MFG/PRO. |
icFinancialTableName | input | character | Name of the Financial table name that is currently being processed. This is used to determine which logic to execute within the method in the cases where one business component has multiple tables that map to MFG/PRO. |
ihFinancialDataBuffer | input | handle | |
ihMfgDataBuffer | input | handle | |
icMfgDomain | input | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program/bmfgemployee.p)
<ANCESTOR-CODE>
assign oiReturnStatus = -98.
if(temp_mstr.tc_status = 'C':U or temp_mstr.tc_status='N':U) then do:
find tMfgAddress no-lock where
tMfgAddress.BusinessRelation_ID = tMfgEmployee.BusinessRelation_ID and
tMfgAddress.tcAddressTypeCode = {&ADDRESSTYPECODESYSTEM-HEADOFFICE} no-error.
/* Assign address & contact information from passed in temp-table values */
if(available(tMfgAddress)) then do:
<Q-14 run StateByIDAllInfo (all) (Read) (NoCache)
(input tMfgAddress.State_ID, (State_ID)
output dataset tqStateByIDAllInfo) in BState >
vcStateCode = ''.
for first tqStateByIDAllInfo where tqStateByIDAllInfo.tiState_ID = tMfgAddress.State_ID:
vcStateCode = tqStateByIDAllInfo.tcStateCode.
end.
assign
temp_mstr.emp_name = tMfgAddress.AddressName
temp_mstr.emp_sort = tMfgAddress.AddressSearchName
temp_mstr.emp_line1 = tMfgAddress.AddressStreet1
temp_mstr.emp_line2 = tMfgAddress.AddressStreet2
temp_mstr.emp_line3 = tMfgAddress.AddressStreet3
temp_mstr.emp_city = tMfgAddress.AddressCity
temp_mstr.emp_state = vcStateCode
temp_mstr.emp_zip = tMfgAddress.AddressZip
temp_mstr.emp_status = if(tMfgEmployee.EmployeeIsActive) then "AC":U else "TR":U.
/* Resolve company (entity) name */
<Q-15 run CompanyPrim (all) (Read) (NoCache)
(input viCompanyId, (LookupCompanyId)
input ?, (CompanyCode)
output dataset tqCompanyPrim) in BCompany >
for first tqCompanyPrim:
temp_mstr.emp_entity = tqCompanyPrim.tcCompanyCode.
end.
/* Retrieve country code & description */
<Q-18 run CountryByCountry (all) (Read) (NoCache)
(input tMfgAddress.Country_ID, (CountryId)
input ?, (CountryCode)
output dataset tqCountryByCountry) in BCountry >
for first tqCountryByCountry where tqCountryByCountry.tiCountry_ID = tMfgAddress.Country_ID:
assign
temp_mstr.emp_country = tqCountryByCountry.tcCountryDescription
temp_mstr.emp_ctry = tqCountryByCountry.tcCountryCode.
end. /* for first tqCountryByCountry */
/* Assign primary and secondary contact phone numbers */
for each tMfgContact where tMfgContact.Address_ID = tMfgAddress.Address_ID:
if(tMfgContact.ContactIsPrimary) then do:
temp_mstr.emp_bs_phone = tMfgContact.ContactTelephone.
end.
if(tMfgContact.ContactIsSecondary) then do:
temp_mstr.emp_phone = tMfgContact.ContactTelephone.
end.
end. /* for each tqContactByAddress */
end.
else do:
/* Assign address information from "HEADOFFICE" address */
<Q-7 run AddressByType (all) (Read) (NoCache)
(input tMfgEmployee.BusinessRelation_ID, (BusinessRelationID)
input 'HEADOFFICE':U, (AddressType)
output dataset tqAddressByType) in BBusinessRelation >
for each tqAddressByType where tqAddressByType.tiBusinessRelation_ID = tMfgEmployee.BusinessRelation_ID:
<Q-13 run StateByIDAllInfo (all) (Read) (NoCache)
(input tqAddressByType.tiState_ID, (State_ID)
output dataset tqStateByIDAllInfo) in BState >
vcStateCode = ''.
for first tqStateByIDAllInfo where tqStateByIDAllInfo.tiState_ID = tqAddressByType.tiState_ID:
vcStateCode = tqStateByIDAllInfo.tcStateCode.
end.
assign
temp_mstr.emp_name = tqAddressByType.tcAddressName
temp_mstr.emp_sort = tqAddressByType.tcAddressSearchName
temp_mstr.emp_line1 = tqAddressByType.tcAddressStreet1
temp_mstr.emp_line2 = tqAddressByType.tcAddressStreet2
temp_mstr.emp_line3 = tqAddressByType.tcAddressStreet3
temp_mstr.emp_city = tqAddressByType.tcAddressCity
temp_mstr.emp_state = vcStateCode
temp_mstr.emp_zip = tqAddressByType.tcAddressZip
temp_mstr.emp_status = if(tMfgEmployee.EmployeeIsActive) then "AC":U else "TR":U.
/* Resolve company (entity) name */
<Q-12 run CompanyPrim (all) (Read) (NoCache)
(input viCompanyId, (LookupCompanyId)
input ?, (CompanyCode)
output dataset tqCompanyPrim) in BCompany >
for first tqCompanyPrim:
temp_mstr.emp_entity = tqCompanyPrim.tcCompanyCode.
end.
/* Retrieve country code & description */
<Q-9 run CountryByCode (all) (Read) (NoCache)
(input tqAddressByType.tcCountryCode, (CountryCode)
output dataset tqCountryByCode) in BCountry >
for first tqCountryByCode:
assign
temp_mstr.emp_country = tqCountryByCode.tcCountryDescription
temp_mstr.emp_ctry = tqCountryByCode.tcCountryCode.
end. /* for first tqCountryByCode */
/* Assign primary and secondary contact phone numbers */
<Q-11 run ContactByAddress (all) (Read) (NoCache)
(input tqAddressByType.tiAddress_ID, (AddressId)
output dataset tqContactByAddress) in BBusinessRelation >
for each tqContactByAddress:
if(tqContactByAddress.tlContactIsPrimary) then do:
temp_mstr.emp_bs_phone = tqContactByAddress.tcContactTelephone.
end.
if(tqContactByAddress.tlContactIsSecondary) then do:
temp_mstr.emp_phone = tqContactByAddress.tcContactTelephone.
end.
end. /* for each tqContactByAddress */
end /* for each tqAddressByType */.
end. /* else do */
assign
temp_mstr.emp_domain = vcMfgDomain.
end. /* if(temp_mstr */
if oiReturnStatus = -98 then
assign oiReturnStatus = 0.