project QadFinancials > class BMfgAddress > method ReplicateFromFinancialsShipToUpd
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program9/bmfgaddress.p)
/* ====================================================================================== *
* Method : ReplicateFromFinancialsShipTo *
* Description : Copy data from Finance data into Operational data *
* -------------------------------------------------------------------------------------- *
* Parameters : *
* ====================================================================================== */
assign oiReturnStatus = -98
viLocalReturn = 0.
MAIN_BLOCK:
do on error undo, return:
<Q-78 run CountryByCode (all) (Read) (NoCache)
(input tAddress.tcCountryCode, (CountryCode)
output dataset tqCountryByCode) in BCountry>
find first tqCountryByCode where
tqCountryByCode.tcCountryCode = tAddress.tcCountryCode
no-error.
if available tqCountryByCode
then assign tAddress.tcCountryDescription = tqCountryByCode.tcCountryDescription .
/* Update data */
assign tad_mstr.ad_line1 = tAddress.AddressStreet1
tad_mstr.ad_line2 = tAddress.AddressStreet2
tad_mstr.ad_line3 = tAddress.AddressStreet3
tad_mstr.ad_zip = tAddress.AddressZip
tad_mstr.ad_city = tAddress.AddressCity
tad_mstr.ad_state = tAddress.AddressState
tad_mstr.ad_county = tAddress.tcCountyCode
tad_mstr.ad_country = tAddress.tcCountryDescription
tad_mstr.ad_state = tAddress.tcStateCode
tad_mstr.ad_ctry = tAddress.tcCountryCode
tad_mstr.ad_lang = tAddress.tcLngCode
tad_mstr.ad_name = tAddress.AddressName
tad_mstr.ad_sort = tAddress.AddressSearchName
tad_mstr.ad_address_id = tAddress.Address_ID
tad_mstr.ad_bus_relation = tDebtorShiptosToUpdate.tcBusinessRelationCode
tad_mstr.ad_mod_date = tAddress.LastModifiedDate
tad_mstr.ad_type = "ship-to":U
tad_mstr.ad_taxable = tAddress.AddressIsTaxable
tad_mstr.ad_tax_zone = tAddress.TxzTaxZone
tad_mstr.ad_taxc = tAddress.TxclTaxCls
tad_mstr.ad_tax_usage = tAddress.TxuTaxUsage
tad_mstr.ad_gst_id = tAddress.AddressTaxIDFederal
tad_mstr.ad_pst_id = tAddress.AddressTaxIDState
tad_mstr.ad_misc1_id = tAddress.AddressTaxIDMisc1
tad_mstr.ad_misc2_id = tAddress.AddressTaxIDMisc2
tad_mstr.ad_misc3_id = tAddress.AddressTaxIDMisc3
tad_mstr.ad_format = tAddress.AddressFormat
tad_mstr.ad_userid = tAddress.LastModifiedUser
tad_mstr.ad_phone = substring(tAddress.AddressTelephone, 1, 20, "CHARACTER")
tad_mstr.ad_fax = substring(tAddress.AddressFax, 1, 20, "CHARACTER")
tad_mstr.ad_email = substring(tAddress.AddressEMail, 1, 48, "CHARACTER")
tad_mstr.ad_tax_in_city = tAddress.AddressIsTaxInCity
tad_mstr.tc_Status = (if tDebtorShiptosToUpdate.tc_Status = "D":U
then tDebtorShiptosToUpdate.tc_Status
else tad_mstr.tc_Status)
tad_mstr.ad_temp = tAddress.AddressIsTemporary
tad_mstr.ad_tax_in = tAddress.AddressIsTaxIncluded.
for each tContactsToUpdate where
tContactsToUpdate.Address_ID = tDebtorShiptosToUpdate.Address_ID:
if tContactsToUpdate.ContactIsPrimary
then assign ad_attn = tContactsToUpdate.ContactName
ad_phone = tContactsToUpdate.ContactTelephone
ad_fax = tContactsToUpdate.ContactFax
ad_email = tContactsToUpdate.ContactEmail.
if tContactsToUpdate.ContactIsSecondary
then assign ad_attn2 = tContactsToUpdate.ContactName
ad_phone2 = tContactsToUpdate.ContactTelephone
ad_fax2 = tContactsToUpdate.ContactFax
ad_email2 = tContactsToUpdate.ContactEmail.
end. /* end of for each contact */
end. /* MAIN_BLOCK */
assign oiReturnStatus = viLocalReturn.