project QadFinancials > class BDebtor > method DefaultValuesBusinessRelation
Parameters
icRowId | input | character | |
icBusinessRelationCode | input | character | |
ilStartedFromCalculate | input | logical | |
olDebtorIsTaxable | output | logical | |
olDebtorIsTaxInCity | output | logical | |
olDebtorIsTaxIncluded | output | logical | |
tAddressRefDebtor | output | temp-table | |
ocDebtorTaxZone | output | character | |
ocDebtorTaxIDFederal | output | character | |
ocDebtorTaxIDState | output | character | |
ocDebtorTaxUsage | output | character | |
ocDebtorTaxClass | output | character | |
ocDebtorTaxIDMisc1 | output | character | |
ocDebtorTaxIDMisc2 | output | character | |
ocDebtorTaxIDMisc3 | output | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bdebtor.p)
assign oiReturnStatus = -98.
if icRowId = ?
then assign icRowId = "":U.
if icRowId = "":U
then do:
assign oiReturnStatus = 0.
return.
end.
find bDebtor where
bDebtor.tc_Rowid = icRowId
no-error.
if not available bDebtor
then do:
assign oiReturnStatus = 0.
return.
end.
if icBusinessRelationCode = ?
then assign icBusinessRelationCode = "":U.
if icBusinessRelationCode = "":U
then do:
empty temp-table tAddressRefDebtor.
create tAddressRefDebtor.
assign bDebtor.tcBusinessRelationCode = icBusinessRelationCode
oiReturnStatus = 0.
return.
end.
if bDebtor.tcBusinessRelationCode <> icBusinessRelationCode
then do:
assign bDebtor.DebtorIsTaxable = ?
bDebtor.DebtorIsTaxInCity = ?
bDebtor.DebtorIsTaxIncluded= ?.
empty temp-table tAddressRefDebtor.
end.
if bDebtor.DebtorIsTaxable = ? or
ilStartedFromCalculate
then do:
<Q-1 run AddressByBusinessRelationType (all) (Read) (NoCache)
(input icBusinessRelationCode, (BusinessRelationCode)
input {&ADDRESSTYPECODESYSTEM-HEADOFFICE}, (AddressTypeCode)
output dataset tqAddressByBusinessRelationType) in BBusinessRelation >
find first tqAddressByBusinessRelationType where
tqAddressByBusinessRelationType.tcBusinessRelationCode = icBusinessRelationCode and
tqAddressByBusinessRelationType.tcAddressTypeCode = {&ADDRESSTYPECODESYSTEM-HEADOFFICE}
no-error.
if available tqAddressByBusinessRelationType
then do:
/********************************************************/
/*ca655293 - setting the default taxable for customer */
if bDebtor.tc_Status = 'N':U
then do:
/* find domain restricted status from system property*/
<Q-2 run SystemPropertyByAll (all) (Read) (NoCache) (output dataset tqSystemPropertyByAll) in BSystemProperty >
find first tqSystemPropertyByAll no-error.
if available tqSystemPropertyByAll
then do:
/* if domain restricted is false*/
if tqSystemPropertyByAll.tlSysPropertyIsBusRelDomRes = false
then do:
/* get all the domains for the supplier shared set*/
<Q-3 run DomainBySharedSetDomain (all) (Read) (NoCache)
(input bDebtor.SharedSet_ID, (SharedSetId)
input ?, (DomainID)
input '':U, (DomainCode)
output dataset tqDomainBySharedSetDomain) in BDomain >
find first tqDomainBySharedSetDomain where
tqDomainBySharedSetDomain.tiSharedSet_ID = bDebtor.SharedSet_ID no-error.
if available tqDomainBySharedSetDomain
then do:
assign viDomainCount = 0
vlIsTaxableDefaultSame = true
vlTaxableDefault = false.
/*loop through all the domains for the shared set*/
for each tqDomainBySharedSetDomain where
tqDomainBySharedSetDomain.tiSharedSet_ID = bDebtor.SharedSet_ID:
assign viDomainCount = viDomainCount + 1.
/*get domain taxable flag*/
<Q-4 run MfgTaxControlByDomain (all) (Read) (NoCache)
(input tqDomainBySharedSetDomain.tcDomainCode, (DomainCode)
output dataset tqMfgTaxControlByDomain) in BMfgTaxControl >
/*check if taxable flag is different for multiple domains*/
find first tqMfgTaxControlByDomain where
tqMfgTaxControlByDomain.tctxc_domain = tqDomainBySharedSetDomain.tcDomainCode no-error.
if available tqMfgTaxControlByDomain
then do:
if vlTaxableDefault <> tqMfgTaxControlByDomain.tltxc_default_taxable
then assign vlIsTaxableDefaultSame = false.
else assign vlIstaxableDefaultSame = true.
/* store previous records Taxable in vlTaxableDefault*/
assign vlTaxableDefault = tqMfgTaxControlByDomain.tltxc_default_taxable.
end.
if viDomainCount > 1 and vlIsTaxableDefaultSame = false
then leave.
end. /*for tqDomainBysharedSet*/
/* if only one domain then assign taxable flag of that domain*/
if viDomainCount = 1
then assign bDebtor.DebtorIsTaxable = vlTaxableDefault.
/*if multiple domains */
if viDomainCount > 1
then do:
/*if all domains have same taxable setting then use domains taxable settings else set to false*/
if vlIsTaxableDefaultSame
then assign bDebtor.DebtorIsTaxable = vlTaxableDefault.
else assign bDebtor.DebtorIsTaxable = false.
end.
end. /* if available tqDomainBySharedSet*/
end. /* if tqSystemPropertyByAll.tlSysPropertyIsBusRelDomRes */
else
do:
if not ilStartedFromCalculate
then assign bDebtor.DebtorIsTaxable = tqAddressByBusinessRelationType.tlAddressIsTaxable.
end. /* if tqSystemPropertyByAll.tlSysPropertyIsBusRelDomRes */
end. /* if available systemproperty*/
end. /* if debtor .tc_status*/
/*ca655293*/
/************************************************************/
if not ilStartedFromCalculate
then assign bDebtor.DebtorIsTaxInCity = tqAddressByBusinessRelationType.tlAddressIsTaxInCity
bDebtor.DebtorIsTaxIncluded = tqAddressByBusinessRelationType.tlAddressIsTaxIncluded
bDebtor.TxzTaxZone = tqAddressByBusinessRelationType.tcTxzTaxZone
bDebtor.DebtorTaxIDFederal = tqAddressByBusinessRelationType.tcAddressTaxIDFederal
bDebtor.DebtorTaxIDState = tqAddressByBusinessRelationType.tcAddressTaxIDState
bDebtor.TxuTaxUsage = tqAddressByBusinessRelationType.tcTxuTaxUsage
bDebtor.TxclTaxCls = tqAddressByBusinessRelationType.tcTxclTaxCls
bDebtor.DebtorTaxIDMisc1 = tqAddressByBusinessRelationType.tcAddressTaxIDMisc1
bDebtor.DebtorTaxIDMisc2 = tqAddressByBusinessRelationType.tcAddressTaxIDMisc2
bDebtor.DebtorTaxIDMisc3 = tqAddressByBusinessRelationType.tcAddressTaxIDMisc3.
create tAddressRefDebtor.
buffer-copy tqAddressByBusinessRelationType to tAddressRefDebtor.
end.
end.
assign oiReturnStatus = 0
olDebtorIsTaxable = bDebtor.DebtorIsTaxable
olDebtorIsTaxInCity = bDebtor.DebtorIsTaxInCity
olDebtorIsTaxIncluded= bDebtor.DebtorIsTaxIncluded
ocDebtorTaxZone = bDebtor.TxzTaxZone
ocDebtorTaxIDFederal = bDebtor.DebtorTaxIDFederal
ocDebtorTaxIDState = bDebtor.DebtorTaxIDState
ocDebtorTaxUsage = bDebtor.TxuTaxUsage
ocDebtorTaxClass = bDebtor.TxclTaxCls
ocDebtorTaxIDMisc1 = bDebtor.DebtorTaxIDMisc1
ocDebtorTaxIDMisc2 = bDebtor.DebtorTaxIDMisc2
ocDebtorTaxIDMisc3 = bDebtor.DebtorTaxIDMisc3.