| bcPostingTcRowid | input-output | character | The tc_rowid of the posting your want a new posting-line for |
| btTaxPointDate | input-output | date | tax point date of the posting-line |
| bcPostingLineText | input-output | character | Posting-line-text |
| bcCurrencyCode | input-output | character | Currency Code of the posting-line that will be created |
| bcPostingVatInOut | input-output | character | Indicates the direction of the taxes: for supplier invoices this will normaly be the incomming direction. Use proprocessors: VATINOUT |
| icPostingVatCode | input | character | |
| icPostingVatDomain | input | character | |
| bdExchangeRate | input-output | decimal | Exchange Rate of the posting-line that will be created. This is the rate information between TC and LC |
| bdExchangeRateScale | input-output | decimal | Exchange Rate Scale of the posting-line that will be created. This is the rate information between TC and LC |
| bcExchangeRateType | input-output | character | Type of the exchange rate of the posting-line that will be created. This is the rate information between TC and LC |
| bcTransactionType | input-output | character | Transaction-Type: corresponds with field PostingVat.PostingVatTransType. Use following preprocessores to fill this parameter: VATTRANSACTIONTYPES |
| bcTaxTransactionType | input-output | character | Tax-Transaction-Type: corresponds with no specific field in the posting but is used to determine some other information. Pass following preprocessors for this parameter: VATTAXTRANSACTIONTYPES |
| bdBaseDebitTC | input-output | decimal | Base-Debit -amount in TC of the posting-line that will be created |
| bdBaseCreditTC | input-output | decimal | Base-Credit-amount in TC of the posting-line that will be created |
| bdBaseDebitLC | input-output | decimal | Base-Debit -amount in LC of the posting-line that will be created |
| bdBaseCreditLC | input-output | decimal | Base-Credit-amount in LC of the posting-line that will be created |
| bdBaseDebitCC | input-output | decimal | Base-Debit-amount in CC of the posting-line that will be created |
| bdBaseCreditCC | input-output | decimal | Base-Credit-amount in CC of the posting-line that will be created |
| bdVatDebitTC | input-output | decimal | Vat-Debit-amount in TC of the posting-line that will be created |
| bdVatCreditTC | input-output | decimal | Vat-Credit-amount in TC of the posting-line that will be created |
| bdVatDebitLC | input-output | decimal | Vat-Debit-amount in LC of the posting-line that will be created |
| bdVatCreditLC | input-output | decimal | Vat-Credit-amount in LC of the posting-line that will be created |
| bdVatDebitCC | input-output | decimal | Vat-Debit-amount in CC of the posting-line that will be created |
| bdVatCreditCC | input-output | decimal | Vat-Credit-amount in CC of the posting-line that will be created |
| bcNormalTaxGLCode | input-output | character | GL-code of the posting-line that will be created |
| bcNormalTaxDivisionCode | input-output | character | Division-code of the posting-line that will be created |
| blNormalTaxIsAlreadyAbsRet | input-output | logical | NormalTaxIsAlreadyAbsRet: set to true in case the posting-line and posting-vat identified by icNormalTaxGLCode concerns an absorbed or retained tax. If this parameter is true then icAbsRetTaxGLCode should be empty |
| bcAbsRetTaxGLCode | input-output | character | GL-Code that will be used for the tax-postingline that covers the absorbed or retained taxes |
| bcAbsRetTaxDivisionCode | input-output | character | DivisionCode that will be used for the tax-postingline that covers the absorbed or retained taxes |
| bcFromTaxZone | input-output | character | From Tax Zone |
| bcToTaxZone | input-output | character | To Tax Zone |
| bcTaxEnvrionment | input-output | character | Tax Environment |
| blIsTaxable | input-output | logical | Is Taxable flag |
| bcTaxClass | input-output | character | Tax Class |
| bcTaxUsage | input-output | character | Tax Usage |
| bcTaxType | input-output | character | Tax Type |
| iiTaxAddressID | input | integer | Ship From Address ID in case of purchasing: this paramater is not indeed if the next 5 parameters about the Tax are specified. If this field is filled, then the next 5 parameters are not taken into account. |
| bcTaxIDFeder | input-output | character | TaxIDFeder of the TaxAddress |
| bcTaxIDState | input-output | character | State of the TaxAddress |
| bcTaxIDMisc1 | input-output | character | Misc1 of the TaxAddress |
| bcTaxIDMisc2 | input-output | character | Misc2 of the TaxAddress |
| bcTaxIDMisc3 | input-output | character | Misc3 of the TaxAddress |
| iiOwnAddressID | input | integer | Ship To Address ID (address of our own company) in case of purchasing: this parameter is not indeed if the next 6 parameters about the Own-address are specified. If this field is filled, then the next 6 parameters are not taken into account. |
| bcOwnTaxIDFeder | input-output | character | OwnTaxIDFeder: Feder of the own address |
| bcOwnTaxIDState | input-output | character | OwnTaxIDState: State of the own address |
| bcOwnTaxIDMisc1 | input-output | character | OwnTaxIDMisc1: Misc1 of the own address |
| bcOwnTaxIDMisc2 | input-output | character | OwnTaxIDMisc2: Misc2 of the own address |
| bcOwnTaxIDMisc3 | input-output | character | OwnTaxIDMisc3: Misc3 of the own address |
| biOwnTaxIDDeclarat | input-output | integer | OwnTaxIDDeclarat: Declarat of the own address |
| blIsSuspDel | input-output | logical | ilIsSuspDel: Is the tax marked as Suspended or Delayed tax |
| oiReturnStatus | output | integer | Return status of the method. |
QadFinancials
/* ================== */
/* Exception handling */
/* ================== */
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
/* ================== */
/* Exception handling */
/* ================== */
VALIDATIONSBLOCK: DO :
/* =============================================== */
/* Replace unknown values and do some defaulting */
/* Check for errors as well */
/* =============================================== */
if bcPostingTcRowid = ? then assign bcPostingtcRowid = "":U.
if bcPostingLineText = ? then assign bcPostingLineText = "":U.
if bdBaseDebitTC = ? then assign bdBaseDebitTC = 0.
if bdBaseCreditTC = ? then assign bdBaseCreditTC = 0.
if bdBaseDebitLC = ? then assign bdBaseDebitLC = 0.
if bdBaseCreditLC = ? then assign bdBaseCreditLC = 0.
if bdBaseDebitCC = ? then assign bdBaseDebitCC = 0.
if bdBaseCreditCC = ? then assign bdBaseCreditCC = 0.
if bdVatDebitTC = ? then assign bdVatDebitTC = 0.
if bdVatCreditTC = ? then assign bdVatCreditTC = 0.
if bdVatDebitLC = ? then assign bdVatDebitLC = 0.
if bdVatCreditLC = ? then assign bdVatCreditLC = 0.
if bdVatDebitCC = ? then assign bdVatDebitCC = 0.
if bdVatCreditCC = ? then assign bdVatCreditCC = 0.
if bcNormalTaxDivisionCode = ? then assign bcNormalTaxDivisionCode = "":U.
if blNormalTaxIsAlreadyAbsRet = ? then assign blNormalTaxIsAlreadyAbsRet = false.
if bcAbsRetTaxGLCode = ? then assign bcAbsRetTaxGLCode = "":U.
if bcAbsRetTaxDivisionCode = ? then assign bcAbsRetTaxDivisionCode = "":U.
if bcFromTaxZone = ? then assign bcFromTaxZone = "":U.
if bcToTaxZone = ? then assign bcToTaxZone = "":U.
if bcTaxEnvrionment = ? then assign bcTaxEnvrionment = "":U.
if bcTaxClass = ? then assign bcTaxClass = "":U.
if bcTaxUsage = ? then assign bcTaxUsage = "":U.
if bcTaxType = ? then assign bcTaxType = "":U.
if iiTaxAddressID = ? then assign iiTaxAddressID = 0.
if bcTaxIDFeder = ? then assign bcTaxIDFeder = "":U.
if bcTaxIDState = ? then assign bcTaxIDState = "":U.
if bcTaxIDMisc1 = ? then assign bcTaxIDMisc1 = "":U.
if bcTaxIDMisc2 = ? then assign bcTaxIDMisc2 = "":U.
if bcTaxIDMisc3 = ? then assign bcTaxIDMisc3 = "":U.
if iiOwnAddressID = ? then assign iiOwnAddressID = 0.
if bcOwnTaxIDFeder = ? then assign bcOwnTaxIDFeder = "":U.
if bcOwnTaxIDState = ? then assign bcOwnTaxIDState = "":U.
if bcOwnTaxIDMisc1 = ? then assign bcOwnTaxIDMisc1 = "":U.
if bcOwnTaxIDMisc2 = ? then assign bcOwnTaxIDMisc2 = "":U.
if bcOwnTaxIDMisc3 = ? then assign bcOwnTaxIDMisc3 = "":U.
if biOwnTaxIDDeclarat = ? then assign biOwnTaxIDDeclarat = 0.
if blIsSuspDel = ? then assign blIsSuspDel = false.
if blIsTaxable = ?
then do :
assign vcMessage = trim(substitute(#T-161'Internal error. The system cannot create the tax posting line because the Is Taxable field is missing.':255(68739)t-161#))
viLocalReturnStatus = -1.
<M-160 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7796':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
Leave VALIDATIONSBLOCK.
end. /* if blIsTaxable = ? */
if bcExchangeRateType = ? or bcExchangeRateType = "":U
then assign bcExchangeRateType = {&EXCHANGERATETYPE-ACCOUNTING}.
if bdExchangeRate = ? or
bdExchangeRate = 0
then if bcCurrencyCode = vcCompanyLC
then assign bdExchangeRate = 1.
else do :
assign vcMessage = trim(substitute(#T-163'Internal error. The system cannot create the tax posting line because the exchange rate is missing.':255(68740)t-163#))
viLocalReturnStatus = -1.
<M-162 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7797':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
Leave VALIDATIONSBLOCK.
end.
if bdExchangeRateScale = ? or
bdExchangeRateScale = 0
then if bcCurrencyCode = vcCompanyLC
then assign bdExchangeRateScale = 1.
else do :
assign vcMessage = trim(substitute(#T-165'Internal error. The system cannot create the tax posting line because the exchange rate scale is missing.':255(68741)t-165#))
viLocalReturnStatus = -1.
<M-164 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7798':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
Leave VALIDATIONSBLOCK.
end.
if bcNormalTaxGLCode = ? or
bcNormalTaxGLCode = "":U
then do :
assign vcMessage = trim(substitute(#T-167'Internal error. The GL account is missing for creating a tax posting line.':255(68742)t-167#))
viLocalReturnStatus = -1.
<M-166 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7799':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
Leave VALIDATIONSBLOCK.
end. /* if bcNormalTaxGLCode = ? or */
if blNormalTaxIsAlreadyAbsRet = true and
bcAbsRetTaxGLCode <> "":U
then do :
assign vcMessage = trim(substitute(#T-192'Internal error. A value was provided for the GL account for absorbed/retained tax, but the normal tax GL account has already been marked as absorbed/retained. ':255(69380)t-192#))
viLocalReturnStatus = -1.
<M-191 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-8024':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
Leave VALIDATIONSBLOCK.
end. /* if blNormalTaxIsAlreadyAbsRet = true and */
if btTaxPointDate = ?
then do :
assign vcMessage = trim(substitute(#T-169'Internal error. The tax posting line cannot be created because the tax point date is missing.':255(68743)t-169#))
viLocalReturnStatus = -1.
<M-168 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7800':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
Leave VALIDATIONSBLOCK.
end. /* if btTaxPointDate = ? */
if bcCurrencyCode = ? or
bcCurrencyCode = "":U
then do :
assign vcMessage = trim(substitute(#T-171'Internal error. The tax posting line cannot be created because the currency code is missing.':255(68744)t-171#))
viLocalReturnStatus = -1.
<M-170 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7801':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
Leave VALIDATIONSBLOCK.
end. /* if bcCurrencyCode = ? or */
if bcPostingVatInOut <> {&VATINOUT-INPUT} and
bcPostingVatInOut <> {&VATINOUT-OUTPUT}
then do :
assign vcMessage = trim(substitute(#T-173'Internal error. The posting tax direction used to create the tax posting line has an invalid value (&1).':255(68745)t-173#,bcPostingVatInOut)) + chr(10) +
trim(substitute(#T-174'The list of valid values is &1.':255(68746)t-174#,{&VATINOUT-INPUT} + ",":U + {&VATINOUT-OUTPUT}))
viLocalReturnStatus = -1.
<M-172 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7802':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
Leave VALIDATIONSBLOCK.
end. /* if bcPostingVatInOut <> {&VATINOUT-INPUT} and */
if lookup(bcTransactionType, {&VATTRANSACTIONTYPES}, chr(2)) = 0
then do :
assign vcMessage = trim(substitute(#T-176'Internal error. The transaction type is using an invalid value (&1) while creating a tax posting line.':255(68747)t-176#,bcTransactionType)) + chr(10) +
trim(substitute(#T-177'The list of valid values is &1.':255(68746)t-177#,{&VATTRANSACTIONTYPES}))
viLocalReturnStatus = -1.
<M-175 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7803':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
Leave VALIDATIONSBLOCK.
end. /* if lookup(bcTransactionType, {&VATTRANSACTIONTYPES}, chr(2)) = 0 */
if lookup(bcTaxTransactionType, {&VATTAXTRANSACTIONTYPES}, chr(2)) = 0
then do :
assign vcMessage = trim(substitute(#T-179'Internal error. The transaction type is using an invalid value (&1) while creating a tax posting line.':255(68747)t-179#,bcTaxTransactionType)) + chr(10) +
trim(substitute(#T-180'The list of valid values is &1.':255(68746)t-180#,{&VATTAXTRANSACTIONTYPES}))
viLocalReturnStatus = -1.
<M-178 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7804':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
Leave VALIDATIONSBLOCK.
end. /* if lookup(bcTaxTransactionType, {&VATTAXTRANSACTIONTYPES}, chr(2)) = 0 */
find tPosting where
tPosting.tc_Rowid = bcPostingtcRowid
no-error.
if not available tPosting
then do:
assign vcMessage = trim(substitute(#T-157'Internal error. The system cannot find the posting based upon its row ID (&1).':255(68738)t-157#,bcPostingtcRowid))
viLocalReturnStatus = -1.
<M-159 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7795':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
Leave VALIDATIONSBLOCK.
end. /* if not available tPosting */
/* ============================================================== */
/* Defaulting mechanism for the tax related fields of the address */
/* ============================================================== */
assign vlStartedAddressByIDMinimal = false.
ADDRESSTAXREALTEDFIELDSBLOCK: DO :
if iiTaxAddressID <> 0
then do :
if vlStartedAddressByIDMinimal = false
then do :
<Q-184 run AddressByIDMinimal (Start) in BBusinessRelation >
assign vlStartedAddressByIDMinimal = true.
end. /* if vlStartedAddressByIDMinimal = false */
<Q-182 run AddressByIDMinimal (all) (Read) (NoCache)
(input iiTaxAddressID, (AddressID)
output dataset tqAddressByIDMinimal) in BBusinessRelation >
find tqAddressByIDMinimal where
tqAddressByIDMinimal.tiAddress_ID = iiTaxAddressID
no-lock no-error.
if not available tqAddressByIDMinimal
then do :
assign vcMessage = trim(substitute(#T-188'The tax posting line cannot be created because the address ID (&1) is invalid.':255(68748)t-188#,string(iiTaxAddressID)))
viLocalReturnStatus = -1.
<M-187 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7806':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
Leave ADDRESSTAXREALTEDFIELDSBLOCK.
end. /* if available tqAddressByIDMinimal */
assign bcTaxIDFeder = tqAddressByIDMinimal.tcAddressTaxIDFederal
bcTaxIDState = tqAddressByIDMinimal.tcAddressTaxIDState
bcTaxIDMisc1 = tqAddressByIDMinimal.tcAddressTaxIDMisc1
bcTaxIDMisc2 = tqAddressByIDMinimal.tcAddressTaxIDMisc2
bcTaxIDMisc3 = tqAddressByIDMinimal.tcAddressTaxIDMisc3.
end. /* if iiTaxAddressID <> 0 */
if iiOwnAddressID <> 0
then do :
if vlStartedAddressByIDMinimal = false
then do :
<Q-185 run AddressByIDMinimal (Start) in BBusinessRelation >
assign vlStartedAddressByIDMinimal = true.
end. /* if vlStartedAddressByIDMinimal = false */
<Q-183 run AddressByIDMinimal (all) (Read) (NoCache)
(input iiOwnAddressID, (AddressID)
output dataset tqAddressByIDMinimal) in BBusinessRelation >
find tqAddressByIDMinimal where
tqAddressByIDMinimal.tiAddress_ID = iiOwnAddressID
no-lock no-error.
if not available tqAddressByIDMinimal
then do :
assign vcMessage = trim(substitute(#T-190'The tax posting line cannot be created because the address ID (&1) is invalid.':255(68748)t-190#,string(iiOwnAddressID)))
viLocalReturnStatus = -1.
<M-189 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-7807':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
Leave ADDRESSTAXREALTEDFIELDSBLOCK.
end. /* if available tqAddressByIDMinimal */
assign bcOwnTaxIDFeder = tqAddressByIDMinimal.tcAddressTaxIDFederal
bcOwnTaxIDState = tqAddressByIDMinimal.tcAddressTaxIDState
bcOwnTaxIDMisc1 = tqAddressByIDMinimal.tcAddressTaxIDMisc1
bcOwnTaxIDMisc2 = tqAddressByIDMinimal.tcAddressTaxIDMisc2
bcOwnTaxIDMisc3 = tqAddressByIDMinimal.tcAddressTaxIDMisc3
biOwnTaxIDDeclarat = tqAddressByIDMinimal.tiAddressTaxDeclaration.
end. /* if iiOwnAddressID <> 0 */
END. /* ADDRESSTAXREALTEDFIELDSBLOCK. */
if vlStartedAddressByIDMinimal = true
then do :
<Q-186 run AddressByIDMinimal (Stop) in BBusinessRelation >
end. /* if vlStartedAddressByIDMinimal = false */
if viLocalReturnStatus < 0
then Leave VALIDATIONSBLOCK.
END. /* VALIDATIONSBLOCK */
/* ================== */
/* Exception handling */
/* ================== */
assign oiReturnStatus = viLocalReturnStatus.