DocType Invoice Vendor

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

Profile for Vendor's Invoice

The Vendor's Invoice (AP Invoice) is a document of base type AP Invoice. It can be issued from the functionality found at

 Menu -> Requisition-to-Invoice -> Invoice (Vendor)

window.

Purpose of the AP Invoice

When in the whole business process it should be used and in what cases its use is specifically not appropriate?

 The functionality for the AP Invoice is used to register the Invoice given by the Vendor along 
 with the purchased products.

Accounting consequences

  • How is the AP Invoice involved in the accounting processes, e.g. what accounts are debited and what accounts are credited through its use (if any)?


Accounts affected by AP Invoice
Posting Type Accounts and their meaning
Debit T_CREDIT_ACCT (12610 - Tax Credit A/R) - Tax Credit
P_INVENTORYCLEARING_ACCT (51400 - Inventory Clearing) - Inventory Clearing
Credit C_RECEIVABLE_ACCT (21100 - Account Payable Trade) - Vendor Liability



  • How and where in the ADempiere's Client App those accounts can be changed (switched to another or complementary meanings)?


Place in the Documents Processing Chain

  • What other documents the AP Invoice generates if any?
 The Customer's Invoice doesn't generate automatically any other documents. Later on, on its basis 
 can be generated the Customer's Payment (AR Receipt).

  • If the document has impact on the stock availability in the warehouse, what is the document's behavior in the extreme cases - when there's not enough or not at all quantities of the product in the warehouse?
 The Invoices do not generate material related documents so they don't have direct impact on the 
 availability of the products in the warehouse.

Debugging the AP Invoice

  • What database tables hold the document's data?
 The main table for the Invoices (where they are created and kept) is C_Invoice. For the Vendor's 
 Invoice there are several auxiliary tables completing its functionality and they are with several more 
 compared to the Customer's Invoice. They are: 
   * C_InvoiceLine, which holds the document's lines (product, quantity, price, etc.)
   * C_LandedCost holds the costs of the products
   * C_LandedCostAllocation represents the allocation of the above costs to receipts
   * M_MatchPO gives the mapping of this Invoice line with corresponding Purchase Order lines
   * M_MatchInv gives the mapping of this Invoice line with corresponding Material Receipt lines
   * C_InvoiceTax, which is responsible for keeping the taxes applied to the Invoice, if any
   * C_AllocationLine is used when a Payment is allocated to the Invoice

  • What Java classes and methods define the document's behavior?
    • The model class MInvoice.java - this class extends the base model X_C_Invoice, implements the interface DocAction and adds complementary methods for invoicing functionality. The most interesting methods involved in the Invoice's Workflow (Process_Invoice) are:
      • MInvoice.processIt(String) - this method is the connection to the class DocumentEngine.java - it creates an instance of the class and by passing it the document's current state (one of the constants defined in the DocAction interface, which value for the document is kept in the database) it gets the appropriate action to be done
      • MInvoice.prepareIt() - does some preliminary actions: checks whether the accounting period is open; explodes BOM (assures that none of the Invoice's products has missing subparts, if any); calculates the total tax of the invoice; creates payment schedule based on the payment term; checks the credit status of the Business Partner; sets the DocAction to complete.
      • MInvoice.completeIt() - call MInvoice.prepareIt(); approves the document if it is not approved; creates cash-lines if the payment term is cash; updates the credit amount of the Business Partner.
    • The posting class Doc_Invoice.java - this class extends the abstract class Doc with concrete implementations of the methods for accounting of documents.
      • Doc_Invoice.post() - respoinsible for performing the posting of the document. It calls Doc_Invoice.postLogic()
      • Doc_Invoice.postLogic() - creates the actual account entries like this: checks whether the account is balanced, the account period is open and the amount is convertible; calls Doc_Invoice.createFacts() - For each line DocLine.getAccount() is called which selects the account of each product from M_Product_Acct based on the product id and the accounting schema.