project QadFinancials > class BCInvoice > business logic query CInvoiceWHTForWHTCreation

Description

CInvoiceWHTForWHTCreation: This query return the elements that are needed for creating the WHT records in class BWithholdingTax.

NOTE!!!!!!!!!!!!!!!!:
This query should nopt be extended in any way unless you also adapt the programcode in BCInvoice that fills a temp-table that is defined like the result-set of this query and unless you also adapt the program-code in class BWithholdingTax


Parameters


iiCompanyIdintegerCompany id
iiCInvoiceIdintegerCInvoice ID
ilUpdateTaxlogicalUpdate Tax


query condition


  each CInvoiceWHT where
CInvoiceWHT.CInvoice_ID = iiCInvoiceId

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

          first Company (inner-join) where
Company.Company_Id = iiCompanyId AND
Company.Company_ID = CInvoice.Company_ID AND

              each CompanyProperty (inner-join) where
CompanyProperty.Company_Id = iiCompanyId AND
CompanyProperty.Company_ID = Company.Company_ID AND

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

          first CostCentre (conditional-join) where
CostCentre.SharedSet_Id = vi_COSTCENTRE_sharedset(iiCompanyId) AND
CostCentre.CostCentre_ID = CInvoice.CostCentre_ID AND

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

              first SharedSet (inner-join) where
SharedSet.SharedSet_ID = Creditor.SharedSet_ID AND

              first WHTCertFormat (conditional-join) where
WHTCertFormat.WHTCertFormat_ID = Creditor.WHTCertFormat_ID AND

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

          first Project (conditional-join) where
Project.SharedSet_Id = vi_PROJECT_sharedset(iiCompanyId) AND
Project.Project_ID = CInvoice.Project_ID AND

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

      first GL (conditional-join) where
GL.SharedSet_Id = vi_GL_sharedset(iiCompanyId) AND
GL.GL_ID = CInvoiceWHT.GL_ID AND

      first Vat (conditional-join) where
Vat.Vat_ID = CInvoiceWHT.Vat_ID AND

          first tx2_mstr (outer-join) where
tx2_mstr.tx2_tax_code = Vat.VatCode AND
tx2_mstr.tx2_update_tax = ilUpdateTax


query resultset tqCInvoiceWHTForWHTCreation


field namedata typedb fielddescription
tiCInvoice_IDintegerCInvoiceWHT.CInvoice_IDLink to CInvoice
tdCInvoiceCCRatedecimalCInvoice.CInvoiceCCRateSC Rate. The statutory exchange rate used by the invoice.
The SC Invoice Amount is calculated based on the SC rate.
tdCInvoiceCCScaledecimalCInvoice.CInvoiceCCScaleScale Factor. This field indicates the scale factor applying to the SC rate in use for foreign currency payments.
tiCInvoiceCurrency_IDintegerCInvoice.CInvoiceCurrency_IDCurrency Code
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.
tlCInvoiceIsWHTlogicalCInvoice.CInvoiceIsWHTWithholding Tax
tdCInvoiceNonDiscAmtTCdecimalCInvoice.CInvoiceNonDiscAmtTCTC Non-discount Amount. This field display the invoice amount without discount in base currency.
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.
ttCInvoicePostingDatedateCInvoice.CInvoicePostingDatePosting Date. This filed indicates the date on which the invoice is to be posted.
api annotation:This field defaults from the invoice creation date.
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.
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.
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
tdCInvoiceWHTAmtCreditTCdecimalCInvoiceWHT.CInvoiceWHTAmtCreditTCTC WHT Amount (CR)
tdCInvoiceWHTAmtDebitTCdecimalCInvoiceWHT.CInvoiceWHTAmtDebitTCTC WHT Amount (DR)
tdCInvoiceWHTBaseAmtCreditTCdecimalCInvoice.CInvoiceWHTBaseAmtCreditTCTC WHT Base Amount (CR)
tdCInvoiceWHTBaseAmtDebitTCdecimalCInvoice.CInvoiceWHTBaseAmtDebitTCTC WHT Base Amount (DR)
tdCInvoiceWHTExpenseCreditTCdecimalCInvoiceWHT.CInvoiceWHTExpenseCreditTCTC Expense (CR)
tdCInvoiceWHTExpenseDebitTCdecimalCInvoiceWHT.CInvoiceWHTExpenseDebitTCTC Expense (DR)
tdCInvoiceWHTFeeCreditTCdecimalCInvoiceWHT.CInvoiceWHTFeeCreditTCTC Fee (CR)
tdCInvoiceWHTFeeDebitTCdecimalCInvoiceWHT.CInvoiceWHTFeeDebitTCTC Fee (DR)
tdCInvoiceWHTTaxFeeCreditTCdecimalCInvoiceWHT.CInvoiceWHTTaxFeeCreditTCTC Taxable Fee (CR)
tdCInvoiceWHTTaxFeeDebitTCdecimalCInvoiceWHT.CInvoiceWHTTaxFeeDebitTCTC Taxable Fee (DR)
tdCInvoiceWHTTotAmtCreditTCdecimalCInvoice.CInvoiceWHTTotAmtCreditTCTC WHT Total Amount (CR)
tdCInvoiceWHTTotAmtDebitTCdecimalCInvoice.CInvoiceWHTTotAmtDebitTCTC WHT Total Amount (DR)
tiCompany_IDintegerCompany.Company_IDRecord ID
tcCompanyCodecharacterCompany.CompanyCodeEntity Code
tcCostCentreCodecharacterCostCentre.CostCentreCodeCost Center: A code that identifies the cost center.
tiCreditor_IDintegerCInvoice.Creditor_IDLink to Creditor
tcCreditorCodecharacterCreditor.CreditorCodeSupplier Code
tiDivision_IDintegerCInvoiceWHT.Division_IDLink to Division
tcDivisionCodecharacterDivision.DivisionCodeSub-Account
tiGL_IDintegerCInvoiceWHT.GL_IDLink to GL
tcGLCodecharacterGL.GLCodeA code identifying the GL account.
tiJournal_IDintegerCInvoice.Journal_IDDaybook Code
tcJournalCodecharacterJournal.JournalCodeA daybook code (maximum eight characters).
tiLocalCurrencyCurrency_IDintegerCompanyProperty.Currency_IDBase Currency
tcLocalCurrencyCurrencyCodecharacterCurrency.CurrencyCodeCurrency Code
tcProjectCodecharacterProject.ProjectCodeProject
tiSharedSet_IDintegerCreditor.SharedSet_IDLink to SharedSet
tcSharedSetCodecharacterSharedSet.SharedSetCodeShared Set Code
tdtx2_tax_pctdecimaltx2_mstr.tx2_tax_pctTax Rate
tctx2_tax_typecharactertx2_mstr.tx2_tax_typeTax Type
tltx2_update_taxlogicaltx2_mstr.tx2_update_taxUpdate Tax Allowed
tiVat_IDintegerCInvoiceWHT.Vat_IDLink to Vat
tcVatCodecharacterVat.VatCodeTax Code
tiWHTCertFormat_IDintegerCreditor.WHTCertFormat_IDLink to Withholding Tax Certificate Format
tcWHTCertFormatCodecharacterWHTCertFormat.WHTCertFormatCodeFormat Code


Internal usage


QadFinancials
method BWithholdingTax.CreateAndOrUpdateWHTSub
dataset BWithholdingTax.tInvoiceWHTPaymentCIWHT