Parameters
icPaySelLineObjectType | input | character | PaySelLineObjectType |
iiPaySelLineParentObject_ID | input | integer | |
ocBusinessRelationCode | output | character | |
ocCreditorCode | output | character | |
ocTSM | output | character | |
ocInternalNumber | output | character | |
ocExternalNumber | output | character | |
otDiscountDueDate | output | date | |
odDiscountPercentage | output | decimal | |
otInvoiceDate | output | date | |
otDueDate | output | date | |
ocInvoiceCurrencyCode | output | character | |
odOpenInvoiceAmountTC | output | decimal | |
odOriginalInvoiceAmountTC | output | decimal | |
odOriginalInvoiceAmountNetTC | output | decimal | |
odInvoiceRate | output | decimal | |
odInvoiceRateScale | output | decimal | |
itPaySelDate | input | date | PaySelDate |
ocDivisionCode | output | character | Sub-Account Code |
oiMasterID | output | integer | |
odNonDiscountableAmountTC | output | decimal | Non Discount Amount |
olCreditorIsWHT | output | logical | creditor supports witholding tax |
oiInvoiceCompany_ID | output | integer | Invoice Company ID |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bpaymentselection.p)
/* CInvoice lines */
if (icPaySelLineObjectType = {&PAYMENTSELECTIONTYPE-INVOICE} or
icPaySelLineObjectType = {&PAYMENTSELECTIONTYPE-INVOICECORR} or
icPaySelLineObjectType = {&PAYMENTSELECTIONTYPE-CREDITNOTE} or
icPaySelLineObjectType = {&PAYMENTSELECTIONTYPE-CREDITNOTECORR} or
icPaySelLineObjectType = {&PAYMENTSELECTIONTYPE-PREPAYMENTINV} or
icPaySelLineObjectType = {&PAYMENTSELECTIONTYPE-ADJUSTMENT}) and
iiPaySelLineParentObject_ID <> 0
then do:
<Q-1 run CInvoiceByPaymentInfo (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input ?, (BusinessRelationCode)
input iiPaySelLineParentObject_ID, (CInvoice_ID)
input ?, (PaymentGroupCode)
input ?, (CurrencyCode)
input ?, (DivisionCode)
input ?, (BusinessRelationIsInterco)
input ?, (CInvoiceType)
input ?, (IsInvoiceApproved)
input ?, (IsLockPayment)
input ?, (CInvoiceIsSelected)
input ?, (CInvoiceIsOpen)
input ?, (BusinessRelationCountryCode)
input {&ADDRESSTYPECODESYSTEM-HEADOFFICE}, (AddressTypeCode)
output dataset tqCInvoiceByPaymentInfo) in BCInvoice >
find first tqCInvoiceByPaymentInfo no-error.
if not available tqCInvoiceByPaymentInfo
then do:
<M-2 run SetMessage
(input #T-8'The expected supplier invoice (ID = $1) was not found. Contact your system administrator to rectify any database inconsistencies. ':150(3001)T-8# (icMessage),
input string(iiPaySelLineParentObject_ID) (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'D':U (icType),
input 2 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1258':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign oiReturnStatus = -98.
return.
end.
assign ocBusinessRelationCode = tqCInvoiceByPaymentInfo.tcBusinessRelationCode
ocCreditorCode = tqCInvoiceByPaymentInfo.tcCreditorCode
olCreditorIsWHT = tqCInvoiceByPaymentInfo.tlCreditorIsWHT
oiMasterID = tqCInvoiceByPaymentInfo.tiCreditor_ID
ocTSM = tqCInvoiceByPaymentInfo.tcCInvoiceTSMNumber
ocInternalNumber = string(tqCInvoiceByPaymentInfo.tiPeriodYear) + "/":U +
tqCInvoiceByPaymentInfo.tcJournalCode + "/":U +
string(tqCInvoiceByPaymentInfo.tiCInvoiceVoucher,"9999999999":U)
ocExternalNumber = tqCInvoiceByPaymentInfo.tcCInvoiceReference
otDiscountDueDate = tqCInvoiceByPaymentInfo.ttCInvoiceDiscountDueDate
/*odDiscountPercentage = tqCInvoiceByPaymentInfo.tdPaymentConditionPercentage*/
otInvoiceDate = tqCInvoiceByPaymentInfo.ttCInvoiceDate
oiInvoiceCompany_ID = viCompanyId
otDueDate = tqCInvoiceByPaymentInfo.ttCInvoiceDueDate
ocInvoiceCurrencyCode = tqCInvoiceByPaymentInfo.tcCurrencyCode
odOpenInvoiceAmountTC = tqCInvoiceByPaymentInfo.tdCInvoiceBalanceDebitTC
+ tqCInvoiceByPaymentInfo.tdCInvoiceBalanceCreditTC
odOriginalInvoiceAmountTC = tqCInvoiceByPaymentInfo.tdCInvoiceOriginalDebitTC
+ tqCInvoiceByPaymentInfo.tdCInvoiceOriginalCreditTC
/* XS JirHol 01/10/2005 */
odOriginalInvoiceAmountNetTC = tqCInvoiceByPaymentInfo.tdCInvoiceOriginalDebitTC
- tqCInvoiceByPaymentInfo.tdCInvoiceVatDebitTC
+ tqCInvoiceByPaymentInfo.tdCInvoiceOriginalCreditTC
- tqCInvoiceByPaymentInfo.tdCInvoiceVatCreditTC
/* XE JirHol 01/10/2005 */
odInvoiceRate = tqCInvoiceByPaymentInfo.tdCInvoiceExchangeRate
odInvoiceRateScale = (if tqCInvoiceByPaymentInfo.tdCinvoiceRateScale <= 0 then 1 else tqCInvoiceByPaymentInfo.tdCinvoiceRateScale)
ocDivisionCode = tqCInvoiceByPaymentInfo.tcDivisionCode
odNonDiscountableAmountTC = tqCInvoiceByPaymentInfo.tdCInvoiceNonDiscAmtTC.
end.
/* DInvoice lines */
if (icPaySelLineObjectType = {&PAYMENTSELECTIONTYPE-DEBTORCREDITNOTE} or
icPaySelLineObjectType = {&PAYMENTSELECTIONTYPE-DEBTORCNCORR}) and
iiPaySelLineParentObject_ID <> 0
then do:
<Q-4 run GetDInvoiceForPaymentSelection (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input ?, (IsPaymentAllowed)
input ?, (BusinessRelationCode)
input iiPaySelLineParentObject_ID, (DInvoice_ID)
input ?, (CurrencyCode)
input ?, (DivisionCode)
input ?, (BusinessRelationIsInterco)
input ?, (DInvoiceType)
input ?, (DInvoiceIsOpen)
input ?, (DInvoiceIsSelected)
input ?, (BusinessRelationCountryCode)
input {&ADDRESSTYPECODESYSTEM-HEADOFFICE}, (AddressTypeCode)
output dataset tqGetDInvoiceForPaymentSelection) in BDInvoice >
find first tqGetDInvoiceForPaymentSelection no-error.
if not available tqGetDInvoiceForPaymentSelection
then do:
<M-3 run SetMessage
(input #T-9'The expected customer invoice (ID = $1) was not found. Contact your system administrator to rectify any database inconsistencies. ':150(3002)T-9# (icMessage),
input string(iiPaySelLineParentObject_ID) (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'D':U (icType),
input 2 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1259':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign oiReturnStatus = -98.
return.
end.
assign ocBusinessRelationCode = tqGetDInvoiceForPaymentSelection.tcBusinessRelationCode
ocCreditorCode = tqGetDInvoiceForPaymentSelection.tcDebtorCode
oiMasterID = tqGetDInvoiceForPaymentSelection.tiDebtor_ID
ocTSM = tqGetDInvoiceForPaymentSelection.tcDInvoiceTSMNumber
ocInternalNumber = string(tqGetDInvoiceForPaymentSelection.tiPeriodYear) + "/":U +
tqGetDInvoiceForPaymentSelection.tcJournalCode + "/":U +
string(tqGetDInvoiceForPaymentSelection.tiDInvoiceVoucher,"9999999999":U)
otDiscountDueDate = tqGetDInvoiceForPaymentSelection.ttDInvoiceDiscountDueDate
odDiscountPercentage = tqGetDInvoiceForPaymentSelection.tdPaymentConditionPercentage
otInvoiceDate = tqGetDInvoiceForPaymentSelection.ttDInvoiceDate
oiInvoiceCompany_ID = viCompanyId
otDueDate = tqGetDInvoiceForPaymentSelection.ttDInvoiceDueDate
ocInvoiceCurrencyCode = tqGetDInvoiceForPaymentSelection.tcCurrencyCode
odOpenInvoiceAmountTC = tqGetDInvoiceForPaymentSelection.tdDInvoiceBalanceDebitTC
- tqGetDInvoiceForPaymentSelection.tdDInvoiceBalanceCreditTC
odOriginalInvoiceAmountTC = tqGetDInvoiceForPaymentSelection.tdDInvoiceOriginalDebitTC
- tqGetDInvoiceForPaymentSelection.tdDInvoiceOriginalCreditTC
/* XS JirHol 01/10/2005 */
odOriginalInvoiceAmountNetTC = tqGetDInvoiceForPaymentSelection.tdDInvoiceOriginalDebitTC
+ tqGetDInvoiceForPaymentSelection.tdDInvoiceVatDebitTC
- tqGetDInvoiceForPaymentSelection.tdDInvoiceOriginalCreditTC
- tqGetDInvoiceForPaymentSelection.tdDInvoiceVatCreditTC
/* XE JirHol 01/10/2005 */
odInvoiceRate = tqGetDInvoiceForPaymentSelection.tdDInvoiceExchangeRate
odInvoiceRateScale = tqGetDInvoiceForPaymentSelection.tdDInvoiceRateScale
ocDivisionCode = tqGetDInvoiceForPaymentSelection.tcDivisionCode
odNonDiscountableAmountTC = tqGetDInvoiceForPaymentSelection.tdDInvoiceNonDiscAmtTC.
end.
/* Prepayment */
if icPaySelLineObjectType = {&PAYMENTSELECTIONTYPE-PREPAYMENT} and
iiPaySelLineParentObject_ID <> 0
then do:
<Q-5 run PaySelPrepayForPaySel (all) (Read) (NoCache)
(input ?, (CurrencyCode)
input ?, (PaymentMeans)
input iiPaySelLineParentObject_ID, (PaySelPrepay_ID)
input viCompanyId, (CompanyId)
input ?, (BusinessRelationCode)
input ?, (BusinessRelationCountryCode)
output dataset tqPaySelPrepayForPaySel) in BPrepayment >
find first tqPaySelPrepayForPaySel no-error.
if not available tqPaySelPrepayForPaySel
then do:
<M-6 run SetMessage
(input #T-10'The expected prepayment (ID = $1) was not found. Contact your system administrator to rectify any database inconsistencies. ':150(3003)T-10# (icMessage),
input string(iiPaySelLineParentObject_ID) (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'D':U (icType),
input 'D':U (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1260':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
assign oiReturnStatus = -98.
return.
end.
assign ocBusinessRelationCode = tqPaySelPrepayForPaySel.tcBusinessRelationCode
ocCreditorCode = tqPaySelPrepayForPaySel.tcCreditorCode
ocInvoiceCurrencyCode = tqPaySelPrepayForPaySel.tcCurrencyCode
ocExternalNumber = tqPaySelPrepayForPaySel.tcPaySelPrepayReferenceText.
if ocInvoiceCurrencyCode = vcCompanyLC
then assign odInvoiceRate = 1
odInvoiceRateScale = 1.
else do:
odInvoiceRateScale = 1.
if itPaySelDate > today
then assign itPaySelDate = today.
<M-56 run GetExchangeRate
(input ? (iiCompanyID),
input ? (iiFromCurrencyID),
input ocInvoiceCurrencyCode (icFromCurrencyCode),
input viCompanyLCId (iiToCurrencyID),
input ? (icToCurrencyCode),
input ? (iiExchangeRateTypeID),
input {&EXCHANGERATETYPE-ACCOUNTING} (icExchangeRateTypeCode),
input itPaySelDate (itValidityDate),
output odInvoiceRate (odExchangeRate),
output odInvoiceRateScale (odExchangeScaleFactor),
output viFcReturnSuper (oiReturnStatus)) in BPaymentSelection>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.
end.
end.