project QadFinancials > class BCreditorReport > business logic query GetWHTWithPayments


Parameters


iiCompanyIdintegerCompany id
icCertFormatCodecharacter
icFromCreditorCodecharacter
iiMonthinteger
iiPaymentNumberFrominteger
iiPaymentNumberTointeger
icPaymentSelCodecharacter
icToCreditorCodecharacter
iiWHTNumberFrominteger
iiWHTNumberTointeger
iiYearinteger


query condition


  each Creditor where
Creditor.SharedSet_Id = vi_CREDITOR_sharedset(iiCompanyId) AND
Creditor.CreditorCode >= icFromCreditorCode AND
Creditor.CreditorCode <= icToCreditorCode

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

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

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

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

      each CInvoice (inner-join) where
CInvoice.Company_Id = iiCompanyId AND
CInvoice.Creditor_ID = Creditor.Creditor_ID AND

          each CDocumentInvoiceXref (inner-join) where
CDocumentInvoiceXref.CInvoice_ID = CInvoice.CInvoice_ID AND

              first CDocument (inner-join) where
CDocument.CDocument_ID = CDocumentInvoiceXref.CDocument_ID AND
CDocument.CDocumentNumber >= iiPaymentNumberFrom AND
CDocument.CDocumentNumber <= iiPaymentNumberTo AND
CDocument.Company_ID > 0

                  first PaySel (conditional-join) where
PaySel.Company_Id = iiCompanyId AND
PaySel.PaySel_ID = CDocument.PaySel_ID AND
PaySel.PaySelCode = icPaymentSelCode

              each WHT (inner-join) where
WHT.Company_Id = iiCompanyId AND
WHT.CDocumentInvoiceXref_ID = CDocumentInvoiceXref.CDocumentInvoiceXref_ID AND
year(WHT.WHTPaymentDate) = iiYear AND
month(WHT.WHTPaymentDate) = iiMonth AND
WHT.WHTNumber >= iiWHTNumberFrom AND
WHT.WHTNumber <= iiWHTNumberTo AND
WHT.WHTStatus <> 'WHTINITIAL' AND
WHT.WHTStatus <> 'WHTVOID'

                  first CInvoiceWHT (inner-join) where
CInvoiceWHT.CInvoiceWHT_ID = WHT.CInvoiceWHT_ID AND

                  first Vat (inner-join) where
(vat.vat_id = wht.vat_id OR
0 = wht.vat_id )

                      first tx2_mstr (inner-join) where
tx2_mstr.tx2_tax_code = Vat.VatCode AND

                  first WHTCertFormat (conditional-join) where
WHTCertFormat.WHTCertFormat_ID = WHT.WHTCertFormat_ID AND
WHTCertFormat.WHTCertFormatCode = icCertFormatCode

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


query resultset tqGetWHTWithPayments


field namedata typedb fielddescription
tcAddressCitycharacterAddress.AddressCityCity. The city for this address. This field can be used to decide the tax zone of the address.
tcAddressCountycharacterAddress.AddressCountyObsolete field
tcAddressNamecharacterAddress.AddressNameName. The full name of this particular address.
The name of a headoffice address is the same as the name of the business relationship and can not be modified.
api annotation:PartialUpdate = yes - defaults to the name of the businessRelation.
tcAddressStreet1characterAddress.AddressStreet1Address: Line one of address details.
This field can be blank.
tcAddressStreet2characterAddress.AddressStreet2Address.Line two of address details.
This field can be blank.
tcAddressStreet3characterAddress.AddressStreet3Address.Line three of address details.
This field can be blank.
tiBusinessRelation_IDintegerBusinessRelation.BusinessRelation_IDRecord ID
tiBusinessRelation_ID1integerAddress.BusinessRelation_IDLink to BusinessRelation
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.
tiCDocument_IDintegerCDocumentInvoiceXref.CDocument_IDLink to CDocument
ttCDocumentCreationDatedateCDocument.CDocumentCreationDateCreation Date.This field indicate the payment creation date.
This field is read-only.
ttCDocumentDueDatedateCDocument.CDocumentDueDateDue Date. The due date for this payment.
tiCDocumentInvoiceXref_IDintegerCDocumentInvoiceXref.CDocumentInvoiceXref_IDRecord ID
tdCDocumentInvoiceXrefDiscTCdecimalCDocumentInvoiceXref.CDocumentInvoiceXrefDiscTCTC Discount Amount. This field indicates the discount amount of the invoice already allocated by transaction currency.
tcCDocumentReferencecharacterCDocument.CDocumentReferenceReference. Reference text for the payment.
tcCDocumentStatuscharacterCDocument.CDocumentStatusStatus. The payment status. The default value for a new record is Initial.
tcCDocumentSubTypecharacterCDocument.CDocumentSubTypeSubtype.This field indicates whether the payment is manual or automatic. You create manual supplier payments through the Supplier Payment activities, and automatic payments through the Supplier Payment Selection activities.
This field is read-only.
tiCInvoice_IDintegerCDocumentInvoiceXref.CInvoice_IDLink to CInvoice
tiCInvoiceCurrency_IDintegerCInvoice.CInvoiceCurrency_IDCurrency Code
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.
tdCInvoiceOriginalCreditCCdecimalCInvoice.CInvoiceOriginalCreditCCSC Invoice Amount (CR). This field displays the credit total invoice amount in the statutory currency.
This field is calculated by the system using the TC Invoice Amount(CR) and the SC Rate.
tdCInvoiceOriginalCreditLCdecimalCInvoice.CInvoiceOriginalCreditLCBC Invoice Amount(CR). This field displays the credit total invoice amount in the base currency.
This field is calculated by the system using the TC Invoice Amount(CR) and the Exchange rate.
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.
tdCInvoiceOriginalDebitCCdecimalCInvoice.CInvoiceOriginalDebitCCSC Invoice Amount (DR). This field displays the debit total invoice amount in the statutory currency.
This field is calculated by the system using the TC Invoice Amount(CR) and the SC Rate.
tdCInvoiceOriginalDebitLCdecimalCInvoice.CInvoiceOriginalDebitLCBC Invoice Amount(DR). This field displays the debit total invoice amount in the base currency.
This field is calculated by the system using the TC Invoice Amount(DR) and the Exchange rate.
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.
tiCInvoicePostingYearintegerCInvoice.CInvoicePostingYearYear.This field indicates the accounting year for the invoice.
If you modify these fields, the posting and tax dates are changed correspondingly.
api annotation:This field defaults to the accounting year associated with the posting date.
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.
tdCInvoiceVatBaseCreditCCdecimalCInvoice.CInvoiceVatBaseCreditCCSC Base Amount CR. This field displays the credit base amount in the statutory currency.
This field is calculated by the system using the TC Base Amount CR and the SC rate.
tdCInvoiceVatBaseCreditLCdecimalCInvoice.CInvoiceVatBaseCreditLCBC Base Amount CR. This field displays the credit base amount in the base currency.
This field is calculated by the system using the TC Base Amount CR and the Exchange rate.
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.
tdCInvoiceVatBaseDebitCCdecimalCInvoice.CInvoiceVatBaseDebitCCSC Base Amount DR. This field displays the debit base amount in the statutory currency.
This field is calculated by the system using the TC Base Amount DR and the SC rate.
tdCInvoiceVatBaseDebitLCdecimalCInvoice.CInvoiceVatBaseDebitLCBC Base Amount DR. This field displays the debit base amount in the base currency.
This field is calculated by the system using the TC Base Amount DR and the Exchange rate.
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.
tdCInvoiceVatCreditCCdecimalCInvoice.CInvoiceVatCreditCCSC Tax Amount CR. This field displays the credit tax amount in the statutory currency.
This field is calculated by the system using the TC Tax Amount CR and the SC rate.
tdCInvoiceVatCreditLCdecimalCInvoice.CInvoiceVatCreditLCBC Tax Amount CR. This field displays the debit tax amount in the base currency.
This field is calculated by the system using the TC Tax Amount CR and the Exchange rate.
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.
tdCInvoiceVatDebitCCdecimalCInvoice.CInvoiceVatDebitCCBC Tax Amount DR. This field displays the debit tax amount in the statutory currency.
This field is calculated by the system using the TC Tax Amount DR and the SC rate.
tdCInvoiceVatDebitLCdecimalCInvoice.CInvoiceVatDebitLCBC Tax Amount DR. This field displays the debit tax amount in the base currency.
This field is calculated by the system using the TC Tax Amount DR and the Exchange rate.
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.
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)
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)
tcCountryCodecharacterCountry.CountryCodeCountry Code
tiCreditor_IDintegerCreditor.Creditor_IDRecord ID
tcCreditorCodecharacterCreditor.CreditorCodeSupplier Code
tcCreditorTaxIDFiscalCodecharacterCreditor.CreditorTaxIDFiscalCodeTax ID / Fiscal Code
tiJournal_IDintegerCInvoice.Journal_IDDaybook Code
tcJournalCodecharacterJournal.JournalCodeA daybook code (maximum eight characters).
tcPaymentStatusCalccharactercalculated
tcPaymentSubTypeCalccharactercalculated
tcPaySelCodecharacterPaySel.PaySelCodeCode
tctx2_groupcharactertx2_mstr.tx2_groupTax Group
tdtx2_tax_pctdecimaltx2_mstr.tx2_tax_pctTax Rate
tiVat_IDintegerVat.Vat_IDRecord ID
tcVatCodecharacterVat.VatCodeTax Code
tcVatDescriptioncharacterVat.VatDescriptionDescription
tdWHTAmtCreditTCdecimalWHT.WHTAmtCreditTCWHT Amount Cr TC
tdWHTAmtDebitTCdecimalWHT.WHTAmtDebitTCWHT Amount Dr TC
tcWHTCertFormatCodecharacterWHTCertFormat.WHTCertFormatCodeFormat Code
tdWHTChargeAmtCreditTCdecimalWHT.WHTChargeAmtCreditTCCharge Amount Cr TC
tdWHTChargeAmtDebitTCdecimalWHT.WHTChargeAmtDebitTCCharge Amount Dr TC
tcWHTChargeTypecharacterWHT.WHTChargeTypeCharge Type
tcWHTCInvoiceReferencecharacterWHT.WHTCInvoiceReferenceInvoice Reference
tiWHTNumberintegerWHT.WHTNumberWHT Number
tdWHTPaidAmtCreditTCdecimalWHT.WHTPaidAmtCreditTCPaid Amount Cr TC
tdWHTPaidAmtDebitTCdecimalWHT.WHTPaidAmtDebitTCPaid Amount Dr TC
ttWHTPaymentDatedateWHT.WHTPaymentDatePayment Date
tcWHTPaymentReferencecharacterWHT.WHTPaymentReferencePayment Reference
tdWHTTaxableFeesCreditTCdecimalWHT.WHTTaxableFeesCreditTCTaxable Fee Amount Cr TC
tdWHTTaxableFeesDebitTCdecimalWHT.WHTTaxableFeesDebitTCTaxable Fee Amount Dr TC
tdWHTTotAmtCreditLCdecimalWHT.WHTTotAmtCreditLCTotal Amount Cr BC
tdWHTTotAmtCreditTCdecimalWHT.WHTTotAmtCreditTCTotal Amount Cr TC
tdWHTTotAmtDebitLCdecimalWHT.WHTTotAmtDebitLCTotal Amount Dr LC
tdWHTTotAmtDebitTCdecimalWHT.WHTTotAmtDebitTCTotal Amount Dr TC
tdWHTVATAmtCreditTCdecimalWHT.WHTVATAmtCreditTCTax Amount Cr TC
tdWHTVATAmtDebitTCdecimalWHT.WHTVATAmtDebitTCTax Amount Dr TC


Internal usage


QadFinancials
method BCreditorReport.CreditorWithholdingTaxDue