project QadFinancials > class BPosting > method AddTaxPostingAddress
Description
get the tax id's for the ship from and ship to address
Parameters
iiShipFromAddressId | input | integer | Ship From Address ID |
iiShipToAddressId | input | integer | Ship To Address ID |
ilCustomerInvoice | input | logical | Customer invoice or not ? |
iiCreditorId | input | integer | Creditor ID : used to search the right creditor and to fill the tax id fields of posting vat |
icSoldToDebtorCode | input | character | Sold To Debtor Code : if that is filled, then fill the tax id fields of postingvat with those of the sold to debtor |
ocOwnTaxIdFederal | output | character | Own Tax ID federal |
ocOwnTaxIdState | output | character | Own Tax ID State |
ocOwnTaxIdMisc1 | output | character | Own Tax ID Misc 1 |
ocOwnTaxIdMisc2 | output | character | Own Tax ID Misc 2 |
ocOwnTaxIdMisc3 | output | character | Own Tax ID Misc 3 |
oiOwnTaxDeclaration | output | integer | Own Tax Declaration |
ocTaxIdFederal | output | character | Tax Id Federal |
ocTaxIdState | output | character | Tax ID State |
ocTaxIdMisc1 | output | character | Tax Id Misc 1 |
ocTaxIdMisc2 | output | character | Tax ID Misc 2 |
ocTaxIdMisc3 | output | character | Tax ID Misc 3 |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bposting.p)
if ilCustomerInvoice
then do :
if iiShipFromAddressId <> 0
then do:
<Q-1 run AddressById (all) (Read) (NoCache)
(input iiShipFromAddressId, (AddressID)
output dataset tqAddressById) in BBusinessRelation >
find first tqAddressById where
tqAddressById.tiAddress_ID = iiShipFromAddressId
no-error.
if available tqAddressById
then assign ocOwnTaxIdFederal = tqAddressById.tcAddressTaxIDFederal
ocOwnTaxIdState = tqAddressById.tcAddressTaxIDState
ocOwnTaxIdMisc1 = tqAddressById.tcAddressTaxIDMisc1
ocOwnTaxIdMisc2 = tqAddressById.tcAddressTaxIDMisc2
ocOwnTaxIdMisc3 = tqAddressById.tcAddressTaxIDMisc3.
end.
if icSoldToDebtorCode <> "":U
then do:
<Q-3 run DebtorByBusinessRelation (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input icSoldToDebtorCode, (DebtorCode)
input ?, (DebtorId)
input ?, (BusinessRelationID)
output dataset tqDebtorByBusinessRelation) in BDebtor >
find first tqDebtorByBusinessRelation where
tqDebtorByBusinessRelation.tcDebtorCode = icSoldToDebtorCode
no-error.
if available tqDebtorByBusinessRelation
then assign ocTaxIdFederal = tqDebtorByBusinessRelation.tcDebtorTaxIDFederal
ocTaxIdState = tqDebtorByBusinessRelation.tcDebtorTaxIDState
ocTaxIdMisc1 = tqDebtorByBusinessRelation.tcDebtorTaxIDMisc1
ocTaxIdMisc2 = tqDebtorByBusinessRelation.tcDebtorTaxIDMisc2
ocTaxIdMisc3 = tqDebtorByBusinessRelation.tcDebtorTaxIDMisc3.
end.
else do:
if iiShipToAddressId <> 0
then do:
<Q-4 run AddressById (all) (Read) (NoCache)
(input iiShipToAddressId, (AddressID)
output dataset tqAddressById) in BBusinessRelation >
find first tqAddressById where
tqAddressById.tiAddress_ID = iiShipToAddressId
no-error.
if available tqAddressById
then assign ocTaxIdFederal = tqAddressById.tcAddressTaxIDFederal
ocTaxIdState = tqAddressById.tcAddressTaxIDState
ocTaxIdMisc1 = tqAddressById.tcAddressTaxIDMisc1
ocTaxIdMisc2 = tqAddressById.tcAddressTaxIDMisc2
ocTaxIdMisc3 = tqAddressById.tcAddressTaxIDMisc3.
end.
end.
end.
else do :
if iiCreditorId <> 0
then do:
<Q-5 run CreditorAllInfo (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input iiCreditorId, (Creditor_ID)
output dataset tqCreditorAllInfo) in BCreditor >
find first tqCreditorAllInfo where
tqCreditorAllInfo.tiCreditor_ID = iiCreditorId
no-error.
if available tqCreditorAllInfo
then assign ocTaxIdFederal = tqCreditorAllInfo.tcCreditorTaxIDFederal
ocTaxIdState = tqCreditorAllInfo.tcCreditorTaxIDState
ocTaxIdMisc1 = tqCreditorAllInfo.tcCreditorTaxIDMisc1
ocTaxIdMisc2 = tqCreditorAllInfo.tcCreditorTaxIDMisc2
ocTaxIdMisc3 = tqCreditorAllInfo.tcCreditorTaxIDMisc3.
end.
if iiShipToAddressId <> 0
then do:
<Q-2 run AddressById (all) (Read) (NoCache)
(input iiShipToAddressId, (AddressID)
output dataset tqAddressById) in BBusinessRelation >
find first tqAddressById where
tqAddressById.tiAddress_ID = iiShipToAddressId
no-error.
if available tqAddressById
then assign ocOwnTaxIdFederal = tqAddressById.tcAddressTaxIDFederal
ocOwnTaxIdState = tqAddressById.tcAddressTaxIDState
ocOwnTaxIdMisc1 = tqAddressById.tcAddressTaxIDMisc1
ocOwnTaxIdMisc2 = tqAddressById.tcAddressTaxIDMisc2
ocOwnTaxIdMisc3 = tqAddressById.tcAddressTaxIDMisc3.
end.
end.