project QadFinancials > class BPaymentSelection > business logic query PaySelLineCInvoiceByPaySelId

Description

This query is created to improve the performance on the Payment Selection load (GetPublicTables). To get more information, check BTS 3934.


Parameters


icAddressTypeCodecharacterThe address type code
icBusinessRelationCodecharacterThe code of the BusinessRelation
icObjectTypeListcharacterA comma-seperated list of the object types which should be filtered.
iiPaySel_IdintegerPayment Selection ID
iiCompanyIdintegerCompany id
iiAddressType_IDinteger


query condition


  each PaySelLine where
PaySelLine.PaySel_ID = iiPaySel_Id AND
PaySelLine.PaySelLineParentObject_ID > 0 AND
PaySelLine.PaySelLineObjectType can-do icObjectTypeList

      first CInvoice (inner-join) where
CInvoice.Company_Id = iiCompanyId AND
CInvoice.CInvoice_ID = PaySelLine.PaySelLineParentObject_ID AND

          each CInvoiceWHT (conditional-join) where
CInvoiceWHT.CInvoice_ID = CInvoice.CInvoice_ID AND

          first Creditor (inner-join) where
Creditor.SharedSet_Id = vi_CREDITOR_sharedset(iiCompanyId) AND
Creditor.Creditor_ID = CInvoice.Creditor_ID AND

              first BusinessRelation (inner-join) where
BusinessRelation.BusinessRelation_ID = Creditor.BusinessRelation_ID AND
BusinessRelation.BusinessRelationCode matches icBusinessRelationCode

                  each Address (inner-join) where
Address.BusinessRelation_ID = BusinessRelation.BusinessRelation_ID AND
Address.AddressType_ID = iiAddressType_ID

                      first AddressType (inner-join) where
AddressType.AddressType_ID = Address.AddressType_ID AND
AddressType.AddressTypeCode = icAddressTypeCode

                      first Country1 (inner-join) where
Country1.Country_ID = Address.Country_ID AND

              first PaymentGroup (conditional-join) where
PaymentGroup.PaymentGroup_ID = Creditor.PaymentGroup_ID AND

          first Currency (inner-join) where
Currency.Currency_ID = CInvoice.CInvoiceCurrency_ID AND

          first Division (conditional-join) where
Division.SharedSet_Id = vi_DIVISION_sharedset(iiCompanyId) AND
Division.Division_ID = CInvoice.Division_ID AND

          first Journal (inner-join) where
Journal.SharedSet_Id = vi_JOURNAL_sharedset(iiCompanyId) AND
Journal.Journal_ID = CInvoice.Journal_ID AND

          first PaymentCondition (inner-join) where
PaymentCondition.PaymentCondition_ID = CInvoice.NormalPaymentCondition_ID AND

          first Period (inner-join) where
Period.Company_Id = iiCompanyId AND
Period.Period_ID = CInvoice.Period_ID AND

          first VatNumber (conditional-join) where
VatNumber.VatNumber_ID = CInvoice.OwnVatNumber_ID AND

              first Country2 (outer-join) where
Country2.Country_ID = VatNumber.DeclarationCountry_ID AND


query resultset tqPaySelLineCInvoiceByPaySelId


field namedata typedb fielddescription
tcAddressTypeCodecharacterAddressType.AddressTypeCodeAddress Type
tcBusinessRelationCodecharacterBusinessRelation.BusinessRelationCodeBusiness Relation. A code to identify the business relation.
If this field does not have a input from the user, the system automatically generates a number for the record based on the sequence defined in Business Relation Autonumber Create.
tcBusinessRelationName1characterBusinessRelation.BusinessRelationName1Name: The full name of the business relation.
This field sets the default name for linked addresses such as customers and suppliers.
api annotation:PartialUpdate = yes - defaults to the BusinessRelationCode.
tiCInvoice_IDintegerCInvoice.CInvoice_IDRecord ID
tiCInvoice_ID1integerCInvoiceWHT.CInvoice_IDLink to CInvoice
tdCInvoiceBalanceCreditTCdecimalCInvoice.CInvoiceBalanceCreditTCTC Balance Amount CR. This field displays the sum of the credit amounts of all posting lines in transaction currency.
tdCInvoiceBalanceDebitTCdecimalCInvoice.CInvoiceBalanceDebitTCTC Balance Amount DR. This field displays the sum of the debit amounts of all posting lines in transaction currency.
tiCInvoiceCompany_IDintegerCInvoice.Company_IDLink to Company
ttCInvoiceDatedateCInvoice.CInvoiceDateInvoice Date. This field indicates the invoice creation date.
The system uses this field with the credit terms to calculate due date and discount date.
api annotation:This field defaults from the system date.
ttCInvoiceDiscountDueDatedateCInvoice.CInvoiceDiscountDueDateDiscount Due Date.This field indicates the last date a discount applies, calculated by the system based on the credit terms and the invoice date.
User can modify this field without affecting the credit terms.
ttCInvoiceDueDatedateCInvoice.CInvoiceDueDateDue Date.This field indicates the date when payment become due.
This field can be modified without affecting the credit terms.
This field is calculated by the system based on the credit terms and the invoice date.
tdCInvoiceExchangeRatedecimalCInvoice.CInvoiceExchangeRateExchange Rate. The exchange rate used by the invoice.
The BC Invoice Amount is calculated based on the exchange rate.
If user modify the TC Invoice Amount, the BC invoice amount is automatically adjusted.
tdCInvoiceHoldAmountTCdecimalCInvoice.CInvoiceHoldAmountTCTC Hold Amount. This field displays the amount of the invoice total that is not to be paid.
If this field is not blank, the hold amount is taken into account during payment processing.
Hold amounts must be:
For invoices or correction invoices: Less than the invoice total and greater than zero.
For credit notes or correction credit notes: Greater than the document total and less than zero.
The hold amount for a negative payment must always be set to zero.
tlCInvoiceIsWHTlogicalCInvoice.CInvoiceIsWHTWithholding Tax
tdCInvoiceOriginalCreditTCdecimalCInvoice.CInvoiceOriginalCreditTCTC Invoice Amount CR. This field displays the credit total invoice amount in the transaction currency.
If you modify this field, the system automatically recalculates the exchange rate to ensure that the BC Invoice Amount remains the same.
tdCInvoiceOriginalDebitTCdecimalCInvoice.CInvoiceOriginalDebitTCTC AP Amount. This field displays the debit total invoice amount in the transaction currency.
If you modify this field, the system automatically recalculates the exchange rate to ensure that the TC Invoice Amount remains the same.
tdCInvoiceRateScaledecimalCInvoice.CInvoiceRateScaleScale Factor. This field indicates the scale factor applying to the exchange rate in use for foreign currency payments.
tcCInvoiceReferencecharacterCInvoice.CInvoiceReferenceReference. An alphanumeric reference to help identify the invoice in the system.
This reference is typically the ID number of the invoice received from the supplier.
tcCInvoiceTSMNumbercharacterCInvoice.CInvoiceTSMNumberPayment Reference. This field displays a unique reference number to be included in the supplier payment file.
This reference can consist of a Transfer with Structured Message (TSM) number.
This field can be blank.
tcCInvoiceTypecharacterCInvoice.CInvoiceTypeInvoice Type. This field identifies the invoice type.
The value can be Invoice Correction and Credit Note Correction type only when the appropriate daybook types have already been defined.
tdCInvoiceVatBaseCreditTCdecimalCInvoice.CInvoiceVatBaseCreditTCTC Base Amount CR. This field displays the credit base amount in the transaction currency.
This field is calculated by the system using the total invoice amount (TC) and the applicable tax rate code.
tdCInvoiceVatBaseDebitTCdecimalCInvoice.CInvoiceVatBaseDebitTCTC Base Amount DR. This field displays the debit base amount in the transaction currency.
This field is calculated by the system using the total invoice amount (TC) and the applicable tax rate code.
tdCInvoiceVatCreditTCdecimalCInvoice.CInvoiceVatCreditTCTC Tax Amount CR. This field displays the credit tax amount (TC) calculated by the system using the total invoice amount (TC) and the applicable tax rate code.
tdCInvoiceVatDebitTCdecimalCInvoice.CInvoiceVatDebitTCTC Tax Amount DR. This field displays the debit tax amount (TC) calculated by the system using the total invoice amount (TC) and the applicable tax rate code.
tiCInvoiceVoucherintegerCInvoice.CInvoiceVoucherVoucher. This field displays the numeric identifier assigned to the posting.
When the daybook of the journal entry is changed (after transfer), the voucher is cleared.
Voucher must be unique in one GL period.
When the user input is zero, the system automatically assign a value not used yet for this field.
tiCInvoiceWHT_IDintegerCInvoiceWHT.CInvoiceWHT_IDRecord ID
tdCInvoiceWHTAmtCreditCCdecimalCInvoiceWHT.CInvoiceWHTAmtCreditCCSC WHT Amount (CR)
tdCInvoiceWHTAmtCreditLCdecimalCInvoiceWHT.CInvoiceWHTAmtCreditLCBC WHT Amount (CR)
tdCInvoiceWHTAmtCreditTCdecimalCInvoiceWHT.CInvoiceWHTAmtCreditTCTC WHT Amount (CR)
tdCInvoiceWHTAmtDebitCCdecimalCInvoiceWHT.CInvoiceWHTAmtDebitCCSC WHT Amount (DR)
tdCInvoiceWHTAmtDebitLCdecimalCInvoiceWHT.CInvoiceWHTAmtDebitLCBC WHT Amount (DR)
tdCInvoiceWHTAmtDebitTCdecimalCInvoiceWHT.CInvoiceWHTAmtDebitTCTC WHT Amount (DR)
tdCInvoiceWHTBaseAmtCreditCCdecimalCInvoice.CInvoiceWHTBaseAmtCreditCCSC WHT Base Amount (CR)
tdCInvoiceWHTBaseAmtCreditLCdecimalCInvoice.CInvoiceWHTBaseAmtCreditLCBC WHT Base Amount (CR)
tdCInvoiceWHTBaseAmtCreditTCdecimalCInvoice.CInvoiceWHTBaseAmtCreditTCTC WHT Base Amount (CR)
tdCInvoiceWHTBaseAmtDebitCCdecimalCInvoice.CInvoiceWHTBaseAmtDebitCCSC WHT Base Amount (DR)
tdCInvoiceWHTBaseAmtDebitLCdecimalCInvoice.CInvoiceWHTBaseAmtDebitLCBC WHT Base Amount (DR)
tdCInvoiceWHTBaseAmtDebitTCdecimalCInvoice.CInvoiceWHTBaseAmtDebitTCTC WHT Base Amount (DR)
tdCInvoiceWHTExpenseCreditTCdecimalCInvoiceWHT.CInvoiceWHTExpenseCreditTCTC Expense (CR)
tdCInvoiceWHTExpenseDebitTCdecimalCInvoiceWHT.CInvoiceWHTExpenseDebitTCTC Expense (DR)
tdCInvoiceWHTFeeCreditTCdecimalCInvoiceWHT.CInvoiceWHTFeeCreditTCTC Fee (CR)
tdCInvoiceWHTFeeDebitTCdecimalCInvoiceWHT.CInvoiceWHTFeeDebitTCTC Fee (DR)
tdCInvoiceWHTTaxFeeCreditCCdecimalCInvoiceWHT.CInvoiceWHTTaxFeeCreditCCSC Taxable Fee (CR)
tdCInvoiceWHTTaxFeeCreditLCdecimalCInvoiceWHT.CInvoiceWHTTaxFeeCreditLCBC Taxable Fee (CR)
tdCInvoiceWHTTaxFeeCreditTCdecimalCInvoiceWHT.CInvoiceWHTTaxFeeCreditTCTC Taxable Fee (CR)
tdCInvoiceWHTTaxFeeDebitCCdecimalCInvoiceWHT.CInvoiceWHTTaxFeeDebitCCSC Taxable Fee (DR)
tdCInvoiceWHTTaxFeeDebitLCdecimalCInvoiceWHT.CInvoiceWHTTaxFeeDebitLCBC Taxable Fee (DR)
tdCInvoiceWHTTaxFeeDebitTCdecimalCInvoiceWHT.CInvoiceWHTTaxFeeDebitTCTC Taxable Fee (DR)
tdCInvoiceWHTTotAmtCreditCCdecimalCInvoice.CInvoiceWHTTotAmtCreditCCSC WHT Total Amount (CR)
tdCInvoiceWHTTotAmtCreditLCdecimalCInvoice.CInvoiceWHTTotAmtCreditLCBC WHT Total Amount (CR)
tdCInvoiceWHTTotAmtCreditTCdecimalCInvoice.CInvoiceWHTTotAmtCreditTCTC WHT Total Amount (CR)
tdCInvoiceWHTTotAmtDebitCCdecimalCInvoice.CInvoiceWHTTotAmtDebitCCSC WHT Total Amount (DR)
tdCInvoiceWHTTotAmtDebitLCdecimalCInvoice.CInvoiceWHTTotAmtDebitLCBC WHT Total Amount (DR)
tdCInvoiceWHTTotAmtDebitTCdecimalCInvoice.CInvoiceWHTTotAmtDebitTCTC WHT Total Amount (DR)
tiCreditor_IDintegerCInvoice.Creditor_IDLink to Creditor
tcCreditorCodecharacterCreditor.CreditorCodeSupplier Code
tlCreditorIsWHTlogicalCreditor.CreditorIsWHTWithholding Tax
tcCurrencyCodecharacterCurrency.CurrencyCodeCurrency Code
tcDeclarationCountryCodecharacterCountry2.CountryCodeCountry Code
tiDivision_IDintegerCInvoiceWHT.Division_IDLink to Division
tcDivisionCodecharacterDivision.DivisionCodeSub-Account
tiGL_IDintegerCInvoiceWHT.GL_IDLink to GL
tcJournalCodecharacterJournal.JournalCodeA daybook code (maximum eight characters).
tdPaymentConditionPercentagedecimalPaymentCondition.PaymentConditionPercentageDiscount Percentage
tiPaySel_IDintegerPaySelLine.PaySel_IDLink to PaySel
tiPaySelLine_IDintegerPaySelLine.PaySelLine_IDRecord ID
tcPaySelLineObjectTypecharacterPaySelLine.PaySelLineObjectTypeType
tiPaySelLineParentObject_IDintegerPaySelLine.PaySelLineParentObject_IDParent Object
tiPeriodYearintegerPeriod.PeriodYearGL Calendar Year
tiVat_IDintegerCInvoiceWHT.Vat_IDLink to Vat


Internal usage


QadFinancials
method BPaymentSelection.CalculatePaySelLine